switch to gofumpt #11
6
Makefile
6
Makefile
@ -14,12 +14,12 @@ default: debug
|
|||||||
commit: fmt lint
|
commit: fmt lint
|
||||||
git commit -a
|
git commit -a
|
||||||
|
|
||||||
# get goimports with:
|
|
||||||
# go get golang.org/x/tools/cmd/goimports
|
|
||||||
# get golangci-lint with:
|
# get golangci-lint with:
|
||||||
# go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.31.0
|
# go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.31.0
|
||||||
|
# get gofumports with:
|
||||||
|
# go get mvdan.cc/gofumpt/gofumports
|
||||||
fmt:
|
fmt:
|
||||||
goimports -l -w .
|
gofumports -l -w .
|
||||||
golangci-lint run --fix
|
golangci-lint run --fix
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
@ -6,9 +6,11 @@ import (
|
|||||||
"git.eeqj.de/sneak/gohttpserver/httpserver"
|
"git.eeqj.de/sneak/gohttpserver/httpserver"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Appname string = "CHANGEME"
|
var (
|
||||||
var Version string
|
Appname string = "CHANGEME"
|
||||||
var Buildarch string
|
Version string
|
||||||
|
Buildarch string
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
os.Exit(httpserver.Run(Appname, Version, Buildarch))
|
os.Exit(httpserver.Run(Appname, Version, Buildarch))
|
||||||
|
@ -127,7 +127,6 @@ func (s *server) serve() int {
|
|||||||
}
|
}
|
||||||
s.cleanShutdown()
|
s.cleanShutdown()
|
||||||
return s.exitCode
|
return s.exitCode
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) cleanupForExit() {
|
func (s *server) cleanupForExit() {
|
||||||
|
@ -66,11 +66,9 @@ func (s *server) LoggingMiddleware() func(http.Handler) http.Handler {
|
|||||||
Int("status", lrw.statusCode).
|
Int("status", lrw.statusCode).
|
||||||
Int("latency_ms", int(latency.Milliseconds())).
|
Int("latency_ms", int(latency.Milliseconds())).
|
||||||
Send()
|
Send()
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
next.ServeHTTP(lrw, r)
|
next.ServeHTTP(lrw, r)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,5 +116,4 @@ func (s *server) MetricsAuthMiddleware() func(http.Handler) http.Handler {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *server) routes() {
|
func (s *server) routes() {
|
||||||
|
|
||||||
s.router = chi.NewRouter()
|
s.router = chi.NewRouter()
|
||||||
|
|
||||||
// the mux .Use() takes a http.Handler wrapper func, like most
|
// the mux .Use() takes a http.Handler wrapper func, like most
|
||||||
@ -93,5 +92,4 @@ func (s *server) routes() {
|
|||||||
r.Get("/metrics", http.HandlerFunc(promhttp.Handler().ServeHTTP))
|
r.Get("/metrics", http.HandlerFunc(promhttp.Handler().ServeHTTP))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user