Skip to content

Commit

Permalink
gha: add golangci-lint
Browse files Browse the repository at this point in the history
Linting is disabled on Windows, as the current build-tags do not
properly exclude non-unix platforms;

    level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 1.0348ms"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:28:18: Stat_t not declared by package unix"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:29:17: Fstat not declared by package unix"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:32:17: Fstat not declared by package unix"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:43:13: Stat_t not declared by package unix"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:44:17: Fstat not declared by package unix"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:56:13: Stat_t not declared by package unix"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:57:17: Fstat not declared by package unix"
    Error: level=error msg="[linters_context] typechecking error: D:\\a\\netns\\netns\\netns.go:71:17: Close not declared by package unix"

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah authored and jeffwidman committed Jan 18, 2023
1 parent 4ed9170 commit 1104d96
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: validate
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
linters:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
timeout-minutes: 10

strategy:
matrix:
# We only run on the latest version of go, as some linters may be
# version-dependent (for example gofmt can change between releases).
go-version: [stable]
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
skip-cache: true
args: --print-resources-usage --verbose

# 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 the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
run:
timeout: 5m

0 comments on commit 1104d96

Please sign in to comment.