Skip to content

Commit

Permalink
Fix the linter, update golang versions. (#422)
Browse files Browse the repository at this point in the history
* golangci to v3 per https://stackoverflow.com/questions/71758856/github-action-for-golangci-lint-fails-with-cant-load-fmt

* add with latest

* add setup-go and specific version

* update version

* Use only one actions/checkout, previous version of go linter

The linter (`golangci`) and the action that runs the linter (`golangci/golangci-lint-action`) are separate. The linter seems to be running but finding new errors, so this change might be enough to temporarily squash those.

* Drop go 1.12 and 1.13,  add 1.17 and 1.18

There's a new golang version every 6 months. The latest two golang versions are supported officially. I'm keeping 1.14 around for now since it was previously the latest supported version.

* Only run linter on 1.17

The 1.18 linter has import issues that we'll investigate later.

* update version

* nolint

* nolint

* nolint

* nolint

* update lint to go 1.18

Co-authored-by: David Schott <[email protected]>
  • Loading branch information
salemhilal and David Schott authored May 25, 2022
1 parent c1ffa46 commit 27fa1ef
Show file tree
Hide file tree
Showing 7 changed files with 289 additions and 286 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.14", "1.13", "1.12"]
go: ["1.18", "1.17", "1.14"]
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v2
Expand Down Expand Up @@ -56,20 +56,23 @@ jobs:
name: lint
strategy:
matrix:
go: ["1.14"]
go: ["1.18"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.3.0
uses: golangci/golangci-lint-action@v3
with:
# the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.35.2
version: v1.46.2

go-test:
strategy:
matrix:
go: ["1.14", "1.13", "1.12"]
go: ["1.18", "1.17", "1.14"]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func repoNameFromUrl(uri string) string {
}

name := uri[ax+1:]
if strings.HasSuffix(name, ".git") {
if strings.HasSuffix(name, ".git") { //nolint
name = name[:len(name)-4]
}

Expand Down
8 changes: 4 additions & 4 deletions cmds/houndd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func makeSearchers(cfg *config.Config) (map[string]*searcher.Searcher, bool, err
if len(errs) > 0 {
// NOTE: This mutates the original config so the repos
// are not even seen by other code paths.
for name, _ := range errs { //nolint
for name, _ := range errs { //nolint
delete(cfg.Repos, name)
}

Expand Down Expand Up @@ -79,7 +79,7 @@ func registerShutdownSignal() <-chan os.Signal {
return shutdownCh
}

func makeTemplateData(cfg *config.Config) (interface{}, error) { //nolint
func makeTemplateData(cfg *config.Config) (interface{}, error) { //nolint
var data struct {
ReposAsJson string
}
Expand All @@ -98,7 +98,7 @@ func makeTemplateData(cfg *config.Config) (interface{}, error) { //nolint
return &data, nil
}

func runHttp( //nolint
func runHttp( //nolint
addr string,
dev bool,
cfg *config.Config,
Expand Down Expand Up @@ -164,7 +164,7 @@ func main() {
handleShutdown(shutdownCh, idx)

host := *flagAddr
if strings.HasPrefix(host, ":") {
if strings.HasPrefix(host, ":") { //nolint
host = "localhost" + host
}

Expand Down
Loading

0 comments on commit 27fa1ef

Please sign in to comment.