From a437d48bf772aa8c7ddef965f420568a86d195ed Mon Sep 17 00:00:00 2001 From: volgingr <111339486+volgingr@users.noreply.github.com> Date: Tue, 14 May 2024 10:02:50 +0300 Subject: [PATCH 1/5] Create git clone --- git clone | 1 + 1 file changed, 1 insertion(+) create mode 100644 git clone diff --git a/git clone b/git clone new file mode 100644 index 0000000..3a91e4c --- /dev/null +++ b/git clone @@ -0,0 +1 @@ +git clone https://github.com/volgingr/GoSample.git From b63819a53a180c61d1ffe80a6de4c60e061f9c63 Mon Sep 17 00:00:00 2001 From: volgingr <111339486+volgingr@users.noreply.github.com> Date: Tue, 14 May 2024 10:17:42 +0300 Subject: [PATCH 2/5] Delete git clone --- git clone | 1 - 1 file changed, 1 deletion(-) delete mode 100644 git clone diff --git a/git clone b/git clone deleted file mode 100644 index 3a91e4c..0000000 --- a/git clone +++ /dev/null @@ -1 +0,0 @@ -git clone https://github.com/volgingr/GoSample.git From 80a564f11ce71598394b77259b8b59f504ad5d70 Mon Sep 17 00:00:00 2001 From: Grigorii Volgin Date: Tue, 14 May 2024 10:39:46 +0300 Subject: [PATCH 3/5] lint --- go.mod | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 go.mod diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..ef96669 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module example.com/m +run: + issues-exit-code: 1 + tests: false + skip-dirs: vendor + +linters-settings: + golint: + skip-dirs-use-default: true +go 1.22.3 From 0535651c617572dcfa64bd66c1bf23668d959af6 Mon Sep 17 00:00:00 2001 From: volgingr <111339486+volgingr@users.noreply.github.com> Date: Tue, 14 May 2024 10:46:09 +0300 Subject: [PATCH 4/5] Update go.mod --- go.mod | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/go.mod b/go.mod index ef96669..289cd40 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,4 @@ module example.com/m -run: - issues-exit-code: 1 - tests: false - skip-dirs: vendor -linters-settings: - golint: - skip-dirs-use-default: true go 1.22.3 + From 587fe1f309a4735b3ba3260aeca1467c7dc14c75 Mon Sep 17 00:00:00 2001 From: Grigorii Volgin Date: Tue, 14 May 2024 11:00:30 +0300 Subject: [PATCH 5/5] update --- workflow.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 workflow.yml diff --git a/workflow.yml b/workflow.yml new file mode 100644 index 0000000..80da21a --- /dev/null +++ b/workflow.yml @@ -0,0 +1,45 @@ +name: GoLint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.22' + + - name: Run linter + run: | + go get -u golang.org/x/lint/golint + golint ./... + + - name: Review code + if: always() + uses: actions/github-script@0.9.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const outputs = []; + const lintOutput = require('child_process') + .execSync('golint ./...', { encoding: 'utf8' }); + outputs.push(lintOutput); + if (outputs.length) { + console.log('Found linting issues:'); + outputs.forEach(output => console.log(output)); + throw new Error('Linting issues were found. Please fix them before merging.'); + } else { + console.log('No linting issues found.'); + }