diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0316a3b..de944f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,32 +12,23 @@ jobs: name: Main Process runs-on: ubuntu-latest env: - GO_VERSION: 1.19 - GOLANGCI_LINT_VERSION: v1.50.0 + GO_VERSION: '1.20' + GOLANGCI_LINT_VERSION: v1.53.3 CGO_ENABLED: 0 steps: - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - # https://github.com/marketplace/actions/checkout - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + go-version: ${{ env.GO_VERSION }} - name: Check and get dependencies run: | diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml index 4bb47a1..6682433 100644 --- a/.github/workflows/go-cross.yml +++ b/.github/workflows/go-cross.yml @@ -19,33 +19,15 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] steps: - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ matrix.go-version }} - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - # https://github.com/marketplace/actions/checkout - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - # https://github.com/marketplace/actions/cache - - name: Cache Go modules - uses: actions/cache@v3 + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ matrix.go-version }} + uses: actions/setup-go@v4 with: - # In order: - # * Module download cache - # * Build cache (Linux) - # * Build cache (Mac) - # * Build cache (Windows) - path: | - ~/go/pkg/mod - ~/.cache/go-build - ~/Library/Caches/go-build - %LocalAppData%\go-build - key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.go-version }}-go- + go-version: ${{ matrix.go-version }} - name: Test run: go test -v -cover ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 452ba27..a6ac87a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,23 +9,23 @@ jobs: name: Release Process runs-on: ubuntu-latest env: - GO_VERSION: 1.19 + GO_VERSION: '1.20' CGO_ENABLED: 0 steps: - # https://github.com/marketplace/actions/setup-go-environment - - name: Set up Go ${{ env.GO_VERSION }} - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - # https://github.com/marketplace/actions/checkout - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + - name: dockerhub-login uses: docker/login-action@v1 with: diff --git a/.golangci.yml b/.golangci.yml index 5b01fb3..882b054 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -20,10 +20,13 @@ linters-settings: gofumpt: extra-rules: true depguard: - list-type: blacklist - include-go-root: false - packages: - - github.com/pkg/errors + rules: + main: + deny: + - pkg: "github.com/instana/testify" + desc: not allowed + - pkg: "github.com/pkg/errors" + desc: Should be replaced by standard lib errors package godox: keywords: - FIXME diff --git a/app.go b/app.go index 90af238..c39008c 100644 --- a/app.go +++ b/app.go @@ -54,6 +54,7 @@ func init() { flag.StringVar(&name, "name", os.Getenv("WHOAMI_NAME"), "give me a name") } +// Data whoami information. type Data struct { Hostname string `json:"hostname,omitempty"` IP []string `json:"ip,omitempty"` diff --git a/go.mod b/go.mod index bd95bb5..2e7699e 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/traefik/whoami -go 1.19 +go 1.20 require github.com/gorilla/websocket v1.4.2