Skip to content

Commit d2d5a13

Browse files
committed
Upgrade baton-sdk to v0.7.4 and Go to 1.25.x
- Update baton-sdk dependency to v0.7.4 - Update Go version to 1.25.2 - Update field.Configuration API - Add WithDefaultCapabilitiesConnectorBuilder option - Update CI workflow to use go-version-file - Update golangci-lint-action to v8 - Update .golangci.yml to v2 format - Add tools/rules.go for ruleguard
1 parent 946be47 commit d2d5a13

File tree

2,261 files changed

+1790139
-260359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,261 files changed

+1790139
-260359
lines changed

.github/workflows/ci.yaml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
11
name: ci
2-
on: pull_request
2+
on:
3+
pull_request:
4+
types: [opened, reopened, synchronize]
5+
push:
6+
branches:
7+
- main
38
jobs:
49
go-lint:
510
runs-on: ubuntu-latest
611
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
714
- name: Install Go
815
uses: actions/setup-go@v5
916
with:
10-
go-version: 1.22.x
11-
- name: Checkout code
12-
uses: actions/checkout@v4
17+
go-version-file: 'go.mod'
1318
- name: Run linters
14-
uses: golangci/golangci-lint-action@v4
19+
uses: golangci/golangci-lint-action@v8
1520
with:
1621
version: latest
1722
args: --timeout=3m
1823
go-test:
1924
strategy:
2025
matrix:
21-
go-version: [1.22.x]
2226
platform: [ubuntu-latest]
2327
runs-on: ${{ matrix.platform }}
2428
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
2531
- name: Install Go
26-
if: success()
2732
uses: actions/setup-go@v5
2833
with:
29-
go-version: ${{ matrix.go-version }}
30-
- name: Checkout code
31-
uses: actions/checkout@v4
34+
go-version-file: 'go.mod'
3235
- name: go tests
3336
run: go test -v -covermode=count -json ./... > test.json
3437
- name: annotate go tests
3538
if: always()
36-
uses: guyarb/golang-test-annotations@v0.5.1
39+
uses: guyarb/golang-test-annotations@v0.6.0
3740
with:
3841
test-results: test.json
3942

@@ -47,12 +50,12 @@ jobs:
4750
CONNECTOR_PRINCIPAL: 'user_01hw3ydazpetds0xzgayvpc2vw'
4851
CONNECTOR_PRINCIPAL_TYPE: 'user'
4952
steps:
50-
- name: Install Go
51-
uses: actions/setup-go@v4
52-
with:
53-
go-version: 1.22.x
5453
- name: Checkout code
5554
uses: actions/checkout@v4
55+
- name: Install Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version-file: 'go.mod'
5659
- name: Build baton-formal
5760
run: go build ./cmd/baton-formal
5861
- name: Run baton-formal
@@ -81,5 +84,3 @@ jobs:
8184
- name: Check grant was re-granted
8285
run:
8386
baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq ".grants[].principal.id.resource == \"user_01hw3ydazpetds0xzgayvpc2vw\""
84-
85-

.github/workflows/main.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.golangci.yml

Lines changed: 118 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,122 @@
1-
linters-settings:
2-
exhaustive:
3-
default-signifies-exhaustive: true
4-
5-
gocritic:
6-
# The list of supported checkers can be find in https://go-critic.github.io/overview.
7-
settings:
8-
underef:
9-
# Whether to skip (*x).method() calls where x is a pointer receiver.
10-
skipRecvDeref: false
11-
12-
govet:
13-
enable-all: true
14-
disable:
15-
- fieldalignment # too strict
16-
- shadow # complains too much about shadowing errors. All research points to this being fine.
17-
18-
nakedret:
19-
max-func-lines: 0
20-
21-
nolintlint:
22-
allow-no-explanation: [ forbidigo, tracecheck, gomnd, gochecknoinits, makezero ]
23-
require-explanation: true
24-
require-specific: true
25-
26-
revive:
27-
ignore-generated-header: true
28-
severity: error
29-
rules:
30-
- name: atomic
31-
- name: line-length-limit
32-
arguments: [ 200 ]
33-
# These are functions that we use without checking the errors often. Most of these can't return an error even
34-
# though they implement an interface that can.
35-
- name: unhandled-error
36-
arguments:
37-
- fmt.Printf
38-
- fmt.Println
39-
- fmt.Fprintf
40-
- fmt.Fprintln
41-
- os.Stderr.Sync
42-
- sb.WriteString
43-
- buf.WriteString
44-
- hasher.Write
45-
- os.Setenv
46-
- os.RemoveAll
47-
- name: var-naming
48-
arguments: [["ID", "URL", "HTTP", "API"], []]
49-
50-
tenv:
51-
all: true
52-
53-
varcheck:
54-
exported-fields: false # this appears to improperly detect exported variables as unused when they are used from a package with the same name
55-
56-
1+
version: "2"
2+
run:
3+
modules-download-mode: readonly
574
linters:
58-
disable-all: true
5+
default: none
596
enable:
60-
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
61-
- gosimple # Linter for Go source code that specializes in simplifying a code
62-
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
63-
- ineffassign # Detects when assignments to existing variables are not used
64-
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
65-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
66-
- unused # Checks Go code for unused constants, variables, functions and types
67-
- asasalint # Check for pass []any as any in variadic func(...any)
68-
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
69-
- bidichk # Checks for dangerous unicode character sequences
70-
- bodyclose # checks whether HTTP response body is closed successfully
71-
- durationcheck # check for two durations multiplied together
72-
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
73-
- execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
74-
- exhaustive # check exhaustiveness of enum switch statements
75-
- exportloopref # checks for pointers to enclosing loop variables
76-
- forbidigo # Forbids identifiers
77-
- gochecknoinits # Checks that no init functions are present in Go code
78-
- goconst # Finds repeated strings that could be replaced by a constant
79-
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
80-
- godot # Check if comments end in a period
81-
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
82-
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
83-
- goprintffuncname # Checks that printf-like functions are named with f at the end
84-
- gosec # Inspects source code for security problems
85-
- nakedret # Finds naked returns in functions greater than a specified function length
86-
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
87-
- noctx # noctx finds sending http request without context.Context
88-
- nolintlint # Reports ill-formed or insufficient nolint directives
89-
- nonamedreturns # Reports all named returns
90-
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
91-
- predeclared # find code that shadows one of Go's predeclared identifiers
92-
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
93-
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
94-
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
95-
- unconvert # Remove unnecessary type conversions
96-
- usestdlibvars # detect the possibility to use variables/constants from the Go standard library
97-
- whitespace # Tool for detection of leading and trailing whitespace
98-
7+
- asasalint
8+
- asciicheck
9+
- bidichk
10+
- bodyclose
11+
- durationcheck
12+
- errcheck
13+
- errorlint
14+
- exhaustive
15+
- forbidigo
16+
- gochecknoinits
17+
- goconst
18+
- gocritic
19+
- godot
20+
- gomoddirectives
21+
- goprintffuncname
22+
- gosec
23+
- govet
24+
- ineffassign
25+
- nakedret
26+
- nilerr
27+
- noctx
28+
- nolintlint
29+
- nonamedreturns
30+
- nosprintfhostport
31+
- predeclared
32+
- revive
33+
- staticcheck
34+
- tparallel
35+
- unconvert
36+
- unused
37+
- usestdlibvars
38+
- whitespace
39+
settings:
40+
exhaustive:
41+
default-signifies-exhaustive: true
42+
gocritic:
43+
enabled-checks:
44+
- ruleguard
45+
settings:
46+
ruleguard:
47+
rules: ${base-path}/tools/rules.go
48+
underef:
49+
skipRecvDeref: false
50+
govet:
51+
disable:
52+
- fieldalignment
53+
- shadow
54+
enable-all: true
55+
nakedret:
56+
max-func-lines: 0
57+
nolintlint:
58+
require-explanation: true
59+
require-specific: true
60+
allow-no-explanation:
61+
- forbidigo
62+
- tracecheck
63+
- gomnd
64+
- gochecknoinits
65+
- makezero
66+
revive:
67+
severity: error
68+
rules:
69+
- name: atomic
70+
- name: line-length-limit
71+
arguments:
72+
- 200
73+
- name: unhandled-error
74+
arguments:
75+
- fmt.Printf
76+
- fmt.Println
77+
- fmt.Fprint
78+
- fmt.Fprintf
79+
- fmt.Fprintln
80+
- os.Stderr.Sync
81+
- sb.WriteString
82+
- buf.WriteString
83+
- hasher.Write
84+
- os.Setenv
85+
- os.RemoveAll
86+
- name: var-naming
87+
arguments:
88+
- - ID
89+
- URL
90+
- HTTP
91+
- API
92+
- []
93+
exclusions:
94+
generated: lax
95+
presets:
96+
- comments
97+
- common-false-positives
98+
- legacy
99+
- std-error-handling
100+
rules:
101+
- linters:
102+
- godot
103+
source: (TODO)
104+
- path: (.+)\.go$
105+
text: third_party$
106+
- path: (.+)\.go$
107+
text: builtin$
108+
- path: (.+)\.go$
109+
text: examples$
110+
paths:
111+
- third_party$
112+
- builtin$
113+
- examples$
99114
issues:
100115
max-same-issues: 50
101-
102-
exclude-rules:
103-
# Don't require TODO comments to end in a period
104-
- source: "(TODO)"
105-
linters: [ godot ]
116+
formatters:
117+
exclusions:
118+
generated: lax
119+
paths:
120+
- third_party$
121+
- builtin$
122+
- examples$

cmd/baton-formal/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/conductorone/baton-formal/pkg/connector"
99
configSchema "github.com/conductorone/baton-sdk/pkg/config"
1010
"github.com/conductorone/baton-sdk/pkg/connectorbuilder"
11+
"github.com/conductorone/baton-sdk/pkg/connectorrunner"
1112
"github.com/conductorone/baton-sdk/pkg/field"
1213
"github.com/conductorone/baton-sdk/pkg/types"
1314
"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap"
@@ -30,7 +31,8 @@ func main() {
3031
_, cmd, err := configSchema.DefineConfiguration(ctx,
3132
connectorName,
3233
getConnector,
33-
field.NewConfiguration(configurationFields),
34+
field.Configuration{Fields: configurationFields},
35+
connectorrunner.WithDefaultCapabilitiesConnectorBuilder(&connector.Connector{}),
3436
)
3537
if err != nil {
3638
fmt.Fprintln(os.Stderr, err.Error())

0 commit comments

Comments
 (0)