Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
chappjc committed Dec 26, 2023
1 parent 6879d03 commit 167f89b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
deadline: 10m
timeout: 10m

output:
format: github-actions,colored-line-number
Expand Down
2 changes: 1 addition & 1 deletion cmd/dcrdata/internal/middleware/apimiddleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ func ChartGroupingCtx(next http.Handler) http.Handler {

// apiDocs generates a middleware with a "docs" in the context containing a map
// of the routers handlers, etc.
func apiDocs(mux *chi.Mux) func(next http.Handler) http.Handler {
func apiDocs(mux *chi.Mux) func(next http.Handler) http.Handler { //nolint
var buf bytes.Buffer
err := json.Indent(&buf, []byte(docgen.JSONRoutesDoc(mux)), "", "\t")
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions cmd/dcrdata/internal/notification/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,10 @@ func (notifier *Notifier) processBlock(bh *wire.BlockHeader) {
go func(h BlockHandler) {
tStart := time.Now()
defer wg.Done()
defer log.Tracef("Notifier: BlockHandler %s completed in %v",
functionName(h), time.Since(tStart))
defer func() {
log.Tracef("Notifier: BlockHandler %s completed in %v",
functionName(h), time.Since(tStart))
}()
if err := h(bh); err != nil {
log.Errorf("block handler failed: %v", err)
return
Expand Down
5 changes: 0 additions & 5 deletions exchanges/rateserver/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,3 @@ func (client *rateClient) SendExchangeUpdate(update *dcrrates.ExchangeRateUpdate
func (client *rateClient) Stream() GRPCStream {
return client.stream
}

// Determine if the grpc.ServerStream's context Done() channel has been closed.
func (client *rateClient) isDone() bool {
return client.stream.Context().Err() != nil
}
16 changes: 1 addition & 15 deletions lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@ MODPATHS="./go.mod ./exchanges/go.mod ./gov/go.mod ./db/dcrpg/go.mod ./cmd/dcrda
./testutil/apiload/go.mod ./exchanges/rateserver/go.mod"
#MODPATHS=$(find . -name go.mod -type f -print)

alias superlint="golangci-lint run --deadline=10m \
--disable-all \
--enable govet \
--enable staticcheck \
--enable gosimple \
--enable unconvert \
--enable ineffassign \
--enable structcheck \
--enable goimports \
--enable misspell \
--enable unparam \
--enable asciicheck \
--enable makezero"

# run lint on all listed modules
set +e
ERROR=0
Expand All @@ -55,7 +41,7 @@ for MODPATH in $MODPATHS; do
module=$(dirname "${MODPATH}")
pushd "$module" > /dev/null
echo "Linting: $MODPATH"
superlint
golangci-lint run
if [[ "$GV" =~ ^1.21 ]]; then
MOD_STATUS=$(git status --porcelain go.mod go.sum)
go mod tidy
Expand Down

0 comments on commit 167f89b

Please sign in to comment.