Skip to content

Commit

Permalink
Use Go 1.19 and up-to-date dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
orlangure committed Sep 26, 2022
1 parent d8fc13b commit 74fb578
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 291 deletions.
13 changes: 1 addition & 12 deletions .circleci/config.yml
Expand Up @@ -8,24 +8,13 @@ commands:
name: install golang
command: |
sudo rm -rf /usr/local/go
wget -c https://dl.google.com/go/go1.17.5.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
wget -c https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
- checkout
- run:
name: Get dependencies
command : go get -v -t -d ./...

jobs:
lint:
docker:
- image: circleci/golang:1.17
steps:
- checkout
- run:
name: golangci-lint
command: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.39.0
$(go env GOPATH)/bin/golangci-lint run ./... --timeout 10m0s
test-core:
machine: true
resource_class: large
Expand Down
77 changes: 40 additions & 37 deletions .github/workflows/test.yaml
Expand Up @@ -9,16 +9,16 @@ jobs:
name: "[core] lint"
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
run: go get -v -t -d ./...
- name: Get golangci-lint
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.39.0
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.49.0
- name: Lint
run: $(go env GOPATH)/bin/golangci-lint run --timeout 10m0s ./...

Expand All @@ -32,10 +32,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand Down Expand Up @@ -90,6 +90,9 @@ jobs:
steps:
- name: Setup postgres
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/runner/.bash_profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install httpie
http --ignore-stdin -v :23042/start/postgres options[custom_named_ports][default][protocol]=tcp options[custom_named_ports][default][port]:=5432 options[custom_named_ports][default][host_port]:=15432 options[debug]:=true
Expand All @@ -108,10 +111,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -131,10 +134,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -154,10 +157,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -177,10 +180,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -200,10 +203,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -223,10 +226,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -246,10 +249,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -269,10 +272,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -292,10 +295,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -315,10 +318,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -338,10 +341,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -361,10 +364,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -384,10 +387,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -407,10 +410,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -430,10 +433,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand All @@ -453,10 +456,10 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Set up Go 1.17
- name: Set up Go 1.19
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
Expand Down
7 changes: 0 additions & 7 deletions .golangci.yml
Expand Up @@ -2,7 +2,6 @@ linters:
enable:
- bodyclose
- cyclop
- deadcode
- depguard
- dogsled
- errcheck
Expand All @@ -23,7 +22,6 @@ linters:
- gosec
- gosimple
- govet
- ifshort
- ineffassign
- lll
- misspell
Expand All @@ -33,17 +31,12 @@ linters:
- prealloc
- predeclared
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- wastedassign
- whitespace
- wsl

Expand Down
2 changes: 1 addition & 1 deletion cmd/cleaner/go.mod
@@ -1,6 +1,6 @@
module github.com/orlangure/gnomock/cmd/cleaner

go 1.18
go 1.19

require github.com/orlangure/gnomock v0.21.0

Expand Down
6 changes: 3 additions & 3 deletions cmd/generator/main.go
Expand Up @@ -14,7 +14,7 @@ import (
)

const (
registryPlaceholder = `// new presets go here
registryPlaceholder = `// new presets go here.
`
startPresetPlaceholder = `### /start/preset
`
Expand All @@ -36,7 +36,7 @@ var (
var fMap = template.FuncMap{
"lower": strings.ToLower,
"title": func(s string) string {
return strings.Title(strings.ToLower(s))
return strings.Title(strings.ToLower(s)) // nolint: staticcheck
},
"snake": func(s string) string {
snake := matchFirstCap.ReplaceAllString(s, "${1}_${2}")
Expand Down Expand Up @@ -315,7 +315,7 @@ func replacePlaceholder(targetFile, tmplFile, placeholder string, params presetP

targetStr := strings.ReplaceAll(string(targetBs), placeholder, buf.String())

if err := os.WriteFile(targetFile, []byte(targetStr), 0644); err != nil {
if err := os.WriteFile(targetFile, []byte(targetStr), 0o644); err != nil {
return fmt.Errorf("can't write %s: %w", targetFile, err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Expand Up @@ -35,5 +35,5 @@ func main() {
}

addr := fmt.Sprintf(":%d", port)
log.Println(http.ListenAndServe(addr, gnomockd.Handler()))
log.Println(http.ListenAndServe(addr, gnomockd.Handler())) // nolint: gosec
}
4 changes: 2 additions & 2 deletions cmd/server/presets.go
@@ -1,7 +1,7 @@
package main

// all known presets should go right here so that they are available when
// requested over HTTP:
// requested over HTTP.
import (
_ "github.com/orlangure/gnomock/preset/cassandra"
_ "github.com/orlangure/gnomock/preset/cockroachdb"
Expand All @@ -19,5 +19,5 @@ import (
_ "github.com/orlangure/gnomock/preset/rabbitmq"
_ "github.com/orlangure/gnomock/preset/redis"
_ "github.com/orlangure/gnomock/preset/splunk"
// new presets go here
// new presets go here.
)

0 comments on commit 74fb578

Please sign in to comment.