diff --git a/.github/workflows/greetings.yaml b/.github/workflows/greetings.yaml deleted file mode 100644 index 1719e90..0000000 --- a/.github/workflows/greetings.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: Greetings - -on: - issues: - types: [opened] - pull_request: - branches: [main] - types: [opened] - -jobs: - greeting: - runs-on: ubuntu-latest - - steps: - - name: Comment pull request - uses: actions/github-script@v6 - if: github.event_name == 'pull_request' - with: - # Comment as whoever you want using `secrets.TAP_GITHUB_TOKEN` or GitHub bot if not set. - github-token: ${{ secrets.TAP_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - let output = `Hello! - - Thank you for your contribution to [golang-cli-template](https://github.com/thazelart/golang-cli-template). - If you are fixing a bug, please reference the issue number in the description. - - We will revise your contribution as soon as possible. - - The golang-cli-template team. - ` - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }) - - - name: Comment issue - uses: actions/github-script@v6 - if: github.event_name != 'pull_request' - with: - # Comment as whoever you want using `secrets.TAP_GITHUB_TOKEN` or GitHub bot if not set. - github-token: ${{ secrets.TAP_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} - script: | - let output = `:wave: Hello! - - Thank you for filing an issue. - If this is a bug report, please include relevant logs to help us debug the problem. - - We will work on this as soon as possible. - - The golang-cli-template team. - ` - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 89bdbdc..83020dd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: "^1.19.4" + go-version: "^1.22.5" - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 with: diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index e4d1564..d1f03e7 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: "^1.19.4" + go-version: "^1.22.5" - name: Init project run: | @@ -53,7 +53,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.50.1 + version: v1.59.1 skip-pkg-cache: true # _____ _ @@ -66,10 +66,11 @@ jobs: run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.txt fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} # ____ _ # | _ \ ___ ___| | _____ _ __ diff --git a/Dockerfile b/Dockerfile index 0e98c29..7a9f86b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG GO_VERSION=1.19 +ARG GO_VERSION=1.22 # Build stage FROM golang:${GO_VERSION} AS builder diff --git a/Makefile b/Makefile index da2a01b..97e896d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BIN_NAME=golang-cli-template IMAGE_NAME=thazelart/${BIN_NAME} BIN_PATH=${GOPATH}/bin -GO_VERSION=1.19 +GO_VERSION=1.22 default: help diff --git a/go.mod b/go.mod index 855afaa..ee3e3ca 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/thazelart/golang-cli-template -go 1.19 +go 1.22 require ( github.com/muesli/mango-cobra v1.2.0 diff --git a/internal/cmd/version/version_test.go b/internal/cmd/version/version_test.go index f3f63da..dd3c480 100644 --- a/internal/cmd/version/version_test.go +++ b/internal/cmd/version/version_test.go @@ -23,12 +23,13 @@ func TestGenerateOutput(t *testing.T) { } func TestPrint(t *testing.T) { + storeStdout := os.Stdout r, w, _ := os.Pipe() os.Stdout = w Print() w.Close() - out, _ := io.ReadAll(r) + os.Stdout = storeStdout assert.Regexp(t, regexp, string(out)) }