code quality fixes
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Piotr Biernat 2022-10-06 22:36:17 +02:00
parent 2245bf1ba6
commit 492638bdd5
3 changed files with 10 additions and 9 deletions

View File

@ -7,7 +7,7 @@ steps:
image: golang:latest image: golang:latest
commands: commands:
- go install honnef.co/go/tools/cmd/staticcheck@latest - go install honnef.co/go/tools/cmd/staticcheck@latest
- staticcheck ./src/internal/... - cd src && staticcheck ./...
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
@ -16,7 +16,7 @@ steps:
image: golang:latest image: golang:latest
commands: commands:
- go install golang.org/x/lint/golint@latest - go install golang.org/x/lint/golint@latest
- golint ./src/internal/... - golint ./src/...
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go
@ -24,7 +24,7 @@ steps:
- name: analyze - name: analyze
image: golang:latest image: golang:latest
commands: commands:
- go vet ./src/internal/... - cd src && go vet ./...
volumes: volumes:
- name: gopath - name: gopath
path: /go path: /go

View File

@ -14,6 +14,7 @@ RUN go mod download && \
FROM gcr.io/distroless/base-debian10 FROM gcr.io/distroless/base-debian10
LABEL author="Piotr Biernat" LABEL author="Piotr Biernat"
LABEL service="identity"
LABEL vendor="Egommerce" LABEL vendor="Egommerce"
LABEL version="1.0" LABEL version="1.0"

View File

@ -14,9 +14,9 @@ import (
) )
const ( const (
defHttpIp = "0.0.0.0" defHTTPIP = "0.0.0.0"
defHttpPort = "8080" defHTTPPort = "8080"
defDbUrl = "postgres://postgres:12345678@postgres_svc:5432/egommerce" defDbURL = "postgres://postgres:12345678@postgres_svc:5432/egommerce"
) )
func main() { func main() {
@ -24,15 +24,15 @@ func main() {
app.Panicf("Error loading .env file") app.Panicf("Error loading .env file")
} }
httpAddr := net.JoinHostPort(config.GetEnv("SERVER_IP", defHttpIp), defHttpPort) httpAddr := net.JoinHostPort(config.GetEnv("SERVER_IP", defHTTPIP), defHTTPPort)
dbConnStr := config.GetEnv("DATABASE_URL", defDbUrl) dbConnStr := config.GetEnv("DATABASE_URL", defDbURL)
dbc, err := database.Connect(dbConnStr) dbc, err := database.Connect(dbConnStr)
if err != nil { if err != nil {
app.Panicf("Unable to connect to database: %v\n", err) app.Panicf("Unable to connect to database: %v\n", err)
} }
env := &handler.Env{httpAddr, dbc} env := &handler.Env{Addr: httpAddr, DB: dbc}
srv := app.NewServer(env) srv := app.NewServer(env)
go srv.Start() go srv.Start()