Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: go

on: [pull_request]

env:
GOPRIVATE: github.com/ninech/apis
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

jobs:
lint:
name: lint
Expand All @@ -14,37 +10,33 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
go-version: stable
- run: go mod tidy -diff
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
- run: go vet ./...
- uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --timeout=10m
- uses: dominikh/staticcheck-action@v1
with:
version: latest
install-go: false
- run: |
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -diff -test ./... && go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -test ./...
- run: go fix -diff ./... | awk '{print} /\S/ {found=1} END {if (found) exit 1}'
- uses: golang/govulncheck-action@v1
with:
repo-checkout: false
cache: false
spell-check:
name: spell-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: crate-ci/typos@v1.41.0
- uses: crate-ci/typos@v1.43.5
test:
name: test
container: ninech/controller-test-image:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
- name: Get dependencies
run: go get -v -t -d ./...
- name: Test
run: go test -v ./...
go-version: stable
- run: make test
15 changes: 5 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ permissions:
packages: write

env:
GOPRIVATE: github.com/ninech/apis
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}

jobs:
Expand All @@ -21,21 +20,18 @@ jobs:
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: setup go
uses: actions/setup-go@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
go-version: stable
- run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Define goreleaser flags
run: test -n "$(git tag --points-at HEAD)" || echo "GORELEASER_FLAGS=--snapshot" >> $GITHUB_ENV
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v6
- uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
Expand All @@ -45,8 +41,7 @@ jobs:
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
- name: Upload assets
uses: actions/upload-artifact@v6
- uses: actions/upload-artifact@v6
with:
name: nctl
path: dist/*
4 changes: 1 addition & 3 deletions edit/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ func writeError(fileName string, editError error, obj client.Object) error {
scanner := bufio.NewScanner(f)
var newFileContents bytes.Buffer
writeHeader(&newFileContents, obj)
if _, err := newFileContents.WriteString(
fmt.Sprintf("# %s\n", printStatusErrorDetails(editError)),
); err != nil {
if _, err := fmt.Fprintf(&newFileContents, "# %s\n", printStatusErrorDetails(editError)); err != nil {
return err
}

Expand Down