ArdanLabs ∴ 2022
Miki Tebeka [email protected], @tebeka, mikitebeka, blog
- Go Essential Training - LinkedIn Learning
- Go Brain Teasers book
- Security best practices
- OWASP top 10
- The security mindset
- casbin - Authorization framework
- golang.org/x/crypto/acme/autocert - Certificates from Let's Encrypt
- Guide to HTTP timeouts
- golang.org/x/time/rate Rate limiting
- OWASP top 10
- gosec - Security oriented linter
- html/template
- gorilla/handlers - CORS
curl -d@./_class/start.json http://localhost:8080/rides
curl -uBond:007 -d@./_class/start.json http://localhost:8080/rides
- Testing overview
- Testing handlers
- Running services in testing
- Mocking
- Performance optimization
- Linters
- staticcheck
- golangci-lint
- Write your own with x/tools/go/analysis
- Testing
- testing
- testify - Many test utilities (including suites & mocking)
- Tutorial: Getting started with fuzzing
- testing/quick - Initial fuzzing library
- test containers
- net/http/httptest
- How SQLite is Tested
- Performance Optimization
- Miki's Optimization guidelines
- Amdahl's Law - Limits of concurrency
- Computer Latency at Human Scale
- Rules of Optimization Club
- Profiling Go Programs In the Go blog
- High Performance Go Workshop by Dave Cheney
- hey
go install github.com/rakyll/hey@latest
export PATH=$(go env GOPATH)/bin:${PATH}
go get github.com/rakyll/hey@latest
- Databases
- Working with
database/sql
- Working with redis
- Logging
- Monitoring
docker exec -it <id> psql -U postgres
- or
pgcli -p 5432 -U postgres -h localhost
- or
docker exec -it <id> redis-cli
- REST APIs
- Handlers
- JSON
- Middleware
Clone the repo:
$ git clone https://github.com/353solutions/srv-2210.git unter
- Configuration
- ArdanLabs service - More complex system
- Validation
- REST APIs
- HTTP status cats
- encoding/json
- net/http
- gorilla/mux - HTTP router with more frills
- chi - A nice web framework
- Also Gin, Echo, Fiber, fasthttp, ...
- Setting up
[library]
layers:
- business
- foundations
front ends: [web] [cli] [gui]
Rules of thumb: imports go downward in the layers
Data Types: one per layer API Business Database
curl -d'{"driver": "gomez", "kind": "private"}' http://localhost:8080/rides
curl -d'{"distance": 3.14}' http://localhost:8080/rides/<id>/end