diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57b9540..2ddcc72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,13 +7,13 @@ jobs: - name: Install Go uses: WillAbides/setup-go-faster@main with: - go-version: 1.21.x + go-version: 1.24.x - uses: actions/checkout@v4 with: path: './src/github.com/kevinburke/ssh_config' # staticcheck needs this for GOPATH - run: | - echo "GO111MODULE=off" >> $GITHUB_ENV + echo "GO111MODULE=on" >> $GITHUB_ENV echo "GOPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV echo "PATH=$GITHUB_WORKSPACE/bin:$PATH" >> $GITHUB_ENV - name: Run tests @@ -23,7 +23,7 @@ jobs: test: strategy: matrix: - go-version: [1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x] + go-version: [1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x, 1.24.x] runs-on: ubuntu-latest steps: - name: Install Go diff --git a/Makefile b/Makefile index 02e15ec..4ee41ab 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,9 @@ BUMP_VERSION := $(GOPATH)/bin/bump_version -STATICCHECK := $(GOPATH)/bin/staticcheck WRITE_MAILMAP := $(GOPATH)/bin/write_mailmap -$(STATICCHECK): - go get honnef.co/go/tools/cmd/staticcheck - -lint: $(STATICCHECK) +lint: go vet ./... - $(STATICCHECK) + go run honnef.co/go/tools/cmd/staticcheck@latest ./... test: @# the timeout helps guard against infinite recursion diff --git a/parser.go b/parser.go index 2b1e718..fdd6ce9 100644 --- a/parser.go +++ b/parser.go @@ -21,9 +21,9 @@ type sshParser struct { type sshParserStateFn func() sshParserStateFn // Formats and panics an error message based on a token -func (p *sshParser) raiseErrorf(tok *token, msg string, args ...interface{}) { +func (p *sshParser) raiseErrorf(tok *token, msg string) { // TODO this format is ugly - panic(tok.Position.String() + ": " + fmt.Sprintf(msg, args...)) + panic(tok.Position.String() + ": " + msg) } func (p *sshParser) raiseError(tok *token, err error) { @@ -118,7 +118,7 @@ func (p *sshParser) parseKV() sshParserStateFn { } pat, err := NewPattern(strPatterns[i]) if err != nil { - p.raiseErrorf(val, "Invalid host pattern: %v", err) + p.raiseErrorf(val, fmt.Sprintf("Invalid host pattern: %v", err)) return nil } patterns = append(patterns, pat) @@ -144,7 +144,7 @@ func (p *sshParser) parseKV() sshParserStateFn { return nil } if err != nil { - p.raiseErrorf(val, "Error parsing Include directive: %v", err) + p.raiseErrorf(val, fmt.Sprintf("Error parsing Include directive: %v", err)) return nil } lastHost.Nodes = append(lastHost.Nodes, inc)