Skip to content

Commit

Permalink
update to go 1.22 and golangci 1.60
Browse files Browse the repository at this point in the history
  • Loading branch information
jhump committed Aug 15, 2024
1 parent dbfc912 commit 92d06e4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: setup-go
uses: actions/setup-go@v4
with:
go-version: 1.22.x
go-version: 1.23.x
- name: make-test
run: make test
- name: make-lint
Expand Down
18 changes: 6 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
run:
skip-dirs-use-default: false
linters-settings:
errcheck:
check-type-assertions: true
Expand All @@ -23,31 +21,27 @@ linters:
enable-all: true
disable:
- cyclop # covered by gocyclo
- deadcode # abandoned
- exhaustivestruct # replaced by exhaustruct
- depguard # unnecessary for small programs
- err113 # don't _always_ need to wrap errors
- execinquery # deprecated in golangci v1.58
- exhaustruct # not useful for this repo (we want to rely on zero values for fields)
- funlen # rely on code review to limit function length
- gocognit # dubious "cognitive overhead" quantification
- gofumpt # prefer standard gofmt
- goimports # rely on gci instead
- golint # deprecated by Go team
- gomnd # some unnamed constants are okay
- ifshort # deprecated by author
- interfacer # deprecated by author
- ireturn # "accept interfaces, return structs" isn't ironclad
- lll # don't want hard limits for line length
- maintidx # covered by gocyclo
- maligned # readability trumps efficient struct packing
- mnd # unnecessary for small programs
- nlreturn # generous whitespace violates house style
- nonamedreturns # named returns are fine, it's *bare* returns that are not
- nosnakecase # deprecated in https://github.com/golangci/golangci-lint/pull/3065
- scopelint # deprecated by author
- structcheck # abandoned
- protogetter # too many false positives
- testpackage # internal tests are fine
- varcheck # abandoned
- wrapcheck # don't _always_ need to wrap errors
- wsl # generous whitespace violates house style
issues:
exclude-dirs-use-default: false
exclude:
# Don't ban use of fmt.Errorf to create new errors, but the remaining
# checks from err113 are useful.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ $(BIN)/license-header: Makefile

$(BIN)/golangci-lint: Makefile
@mkdir -p $(@D)
GOBIN=$(abspath $(@D)) $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.0
GOBIN=$(abspath $(@D)) $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/bufbuild/knit-demo

go 1.21.0
go 1.22

require (
buf.build/gen/go/bufbuild/knit-demo/connectrpc/go v1.15.0-20231005145018-a92ee6b04e01.1
Expand Down
2 changes: 1 addition & 1 deletion go/internal/cmd/gendata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func printItems[T any](varName string, items []*T) {
fmt.Println("\t\t{")
v := reflect.ValueOf(item).Elem()
vt := v.Type()
for i := 0; i < v.NumField(); i++ {
for i := range v.NumField() {
fmt.Printf("\t\t\t%s: ", vt.Field(i).Name)
printItem(v.Field(i).Interface())
fmt.Println(",")
Expand Down
4 changes: 2 additions & 2 deletions go/internal/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ package internal

import (
"context"
"fmt"
"log"
"net"
"net/http"
"strconv"
"strings"
"sync/atomic"
"time"
Expand Down Expand Up @@ -102,7 +102,7 @@ func (i *interceptWriter) Write(bytes []byte) (int, error) {

func (i *interceptWriter) WriteHeader(statusCode int) {
if !i.alreadyWrote {
i.status = fmt.Sprintf("%d", statusCode)
i.status = strconv.Itoa(statusCode)
}
i.w.WriteHeader(statusCode)
}
Expand Down

0 comments on commit 92d06e4

Please sign in to comment.