From 3ef950bcde0abaa468fec8a763354849ce1eea86 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner <50365642+lindnerby@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:01:18 +0200 Subject: [PATCH 1/5] Create go-main.yml --- .github/workflows/go-main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/go-main.yml diff --git a/.github/workflows/go-main.yml b/.github/workflows/go-main.yml new file mode 100644 index 000000000..47afd6045 --- /dev/null +++ b/.github/workflows/go-main.yml @@ -0,0 +1,29 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... From f5a70a704eaff9c10d953ef23ce8b068a8a3881a Mon Sep 17 00:00:00 2001 From: Benjamin Lindner <50365642+lindnerby@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:29:08 +0200 Subject: [PATCH 2/5] Create gha workflow golangci-lint.yml --- .github/workflows/golangci-lint.yml | 55 +++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 000000000..b681f6b8f --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,55 @@ +name: golangci-lint +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Require: The version of golangci-lint to use. + # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. + # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. + version: v1.53 + args: --verbose + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + # + # Note: By default, the `.golangci.yml` file should be at the root of the repository. + # The location of the configuration file can be changed by using `--config=` + # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true, then all caching functionality will be completely disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true, then the action won't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. + # skip-build-cache: true + + # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. + # install-mode: "goinstall" From 0870bcc8841466d9550894c01c7d73ae42744764 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner <50365642+lindnerby@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:42:04 +0200 Subject: [PATCH 3/5] Update .golangci.yml --- .golangci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 723650037..48ae8cbea 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,6 @@ run: modules-download-mode: readonly + timeout: 3m linters: disable-all: true enable: @@ -19,8 +20,6 @@ linters: - unused issues: exclude: - # Check this issue for more info: https://github.com/kyoh86/scopelint/issues/4 - Using the variable on range scope `tc` in function literal max-issues-per-linter: 0 - # show all issues of one type instead of only 3 max-same-issues: 0 From 9e790f46a887a5f2d2a10d75f2148da90d890d4c Mon Sep 17 00:00:00 2001 From: Benjamin Lindner <50365642+lindnerby@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:48:37 +0200 Subject: [PATCH 4/5] Set linter timeout to 15 minutes --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 48ae8cbea..545cdec0f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,6 @@ run: modules-download-mode: readonly - timeout: 3m + timeout: 15m linters: disable-all: true enable: From e90bf9b5ea022bd35ab7b576e3f2959e305e3d90 Mon Sep 17 00:00:00 2001 From: Benjamin Lindner <50365642+lindnerby@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:10:31 +0200 Subject: [PATCH 5/5] add liniting err --- cmd/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/main.go b/cmd/main.go index bc552736c..3c7070e8f 100755 --- a/cmd/main.go +++ b/cmd/main.go @@ -7,6 +7,8 @@ import ( "github.com/kyma-project/cli/internal/cli" ) +const lintFail = "test" + func main() { command := kyma.NewCmd(cli.NewOptions())