Skip to content

Commit

Permalink
Merge branch 'v3' into better-proxy-error-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 authored Aug 21, 2024
2 parents eeacc4d + 970ec0c commit b8602ff
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 8 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: golangci-lint
on:
pull_request:

permissions:
contents: read
checks: write # Optional: allow write access to checks to allow the action to annotate code in the PR.

jobs:
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: false

- name: Touch approle
run: touch ./local/vault/approle.json

- name: Run Golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --timeout 30m --verbose
version: v1.60

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Security Check
name: Vulnerability Check

on:
schedule:
Expand All @@ -16,5 +16,5 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Security checks
- name: Security scan
uses: canonical/comsys-build-tools/.github/actions/security-scan@main
8 changes: 4 additions & 4 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ run:
tests: true
allow-parallel-runners: false
allow-serial-runners: false
# go: "1.17" # Do not set a go limit
# go: "1.23"

issues:
exclude-use-default: true
Expand Down Expand Up @@ -53,8 +53,8 @@ linters:

# Style based linters
- promlinter
- gocritic
- gocognit # To be fixed
- gocritic
- gocognit
- goheader
- importas
- gci
Expand Down Expand Up @@ -87,4 +87,4 @@ linters-settings:
sections:
- standard
- default
- localmodule
- localmodule
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ build: version/commit.txt version/version.txt
build/server: version/commit.txt version/version.txt
go build -tags version ./cmd/jimmsrv

check: version/commit.txt version/version.txt
lint:
golangci-lint run --timeout 5m

check: version/commit.txt version/version.txt lint
go test -timeout 30m $(PROJECT)/... -cover

clean:
Expand Down Expand Up @@ -117,6 +120,7 @@ endef
APT_BASED := $(shell command -v apt-get >/dev/null; echo $$?)
sys-deps:
ifeq ($(APT_BASED),0)
@$(call check_dep,golangci-lint,Missing Golangci-lint - install from https://golangci-lint.run/welcome/install/)
@$(call check_dep,go,Missing Go - install from https://go.dev/doc/install or 'sudo snap install go --classic')
@$(call check_dep,git,Missing Git - install with 'sudo apt install git')
@$(call check_dep,gcc,Missing gcc - install with 'sudo apt install build-essential')
Expand Down
2 changes: 1 addition & 1 deletion doc/golangci-lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ In the .vscode folder of this repository you will find it is defined as the lint
To install, please install the golangci-lint binary or install it via "go install".

The version this was tested with is:
```go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1```
```go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1```
1 change: 1 addition & 0 deletions internal/jimm/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ func (w *Watcher) handleDelta(ctx context.Context, modelIDf func(string) *modelS
var cores int64
machine := d.Entity.(*jujuparams.MachineInfo)
if machine.HardwareCharacteristics != nil && machine.HardwareCharacteristics.CpuCores != nil {
//nolint:gosec // We expect cpu cores to fit into int64.
cores = int64(*machine.HardwareCharacteristics.CpuCores)
}
sCores, ok := state.machines[eid.Id]
Expand Down
1 change: 1 addition & 0 deletions internal/jimmtest/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ func (m *Model) DBObject(c *qt.C, db db.Database) dbmodel.Model {
m.env.Controller(m.Controller)
migrationControllerID := sql.NullInt32{}
if m.MigrationController != "" {
//nolint:gosec // Database IDs for tests will fit into int32.
migrationControllerID.Int32 = int32(m.env.Controller(m.MigrationController).dbo.ID)
migrationControllerID.Valid = true
}
Expand Down
1 change: 1 addition & 0 deletions internal/openfga/openfga.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func (o *OFGAClient) removeTuples(ctx context.Context, tuple Tuple) (err error)
for {
// Since we're deleting the returned tuples, it's best to avoid pagination,
// and fresh query for the relations.
//nolint:gosec // The page size will not exceed int32.
tuples, ct, err := o.ReadRelatedObjects(ctx, tuple, int32(pageSize), "")
if err != nil {
return err
Expand Down

0 comments on commit b8602ff

Please sign in to comment.