From b66546c4a8e42ff2ff8cbe113fce11a081fa5744 Mon Sep 17 00:00:00 2001 From: nitintf Date: Sun, 24 Mar 2024 17:08:20 +0530 Subject: [PATCH] gomod, adding github workflows --- .github/workflows/build.yml | 27 ++++++++++++++++++++++ .golangci.yml | 45 +++++++++++++++++++++++++++++++++++++ go.mod | 1 - go.sum | 2 -- 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .golangci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..69560c2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,27 @@ +name: Build and Lint + +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.21.3' + + - name: Build + run: go build -v ./... + + - name: golangci-lint + uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v3 + with: + args: --timeout=5m + version: v1.56.2 diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..888dd30 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,45 @@ +run: + go: "1.22" + timeout: 5m +linters: + enable: + - thelper + - gofumpt + - tparallel + - unconvert + - unparam + - wastedassign + - revive + - forbidigo + - tagliatelle + - misspell + - depguard + - testifylint + - gocritic +linters-settings: + staticcheck: + checks: + - all + - "-SA1019" + forbidigo: + forbid: + - 'ioutil\.*' + tagliatelle: + case: + use-field-name: false + rules: + yaml: snake + json: snake + depguard: + rules: + main: + deny: + - pkg: "github.com/pkg/errors" + desc: "use stdlib instead" + gocritic: + enabled-checks: + - exitAfterDefer + testifylint: + enable-all: true + disable: + - error-is-as # false positive diff --git a/go.mod b/go.mod index 1fe9e35..74b6877 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.21.3 require ( github.com/briandowns/spinner v1.23.0 github.com/google/generative-ai-go v0.10.0 - github.com/joho/godotenv v1.5.1 github.com/spf13/cobra v1.8.0 google.golang.org/api v0.149.0 ) diff --git a/go.sum b/go.sum index 0e56d7a..18b5932 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,6 @@ github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56 github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= -github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=