Skip to content

Commit 5c27297

Browse files
fix: isolate stringify optimization and revert unrelated changes
1 parent 99d3d92 commit 5c27297

29 files changed

Lines changed: 784 additions & 236 deletions

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
12-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
12+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
1313
with:
1414
go-version: 1.x
1515
cache-dependency-path: "**/go.sum"

.github/workflows/tests.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,11 @@ jobs:
4242
runs-on: ${{ matrix.platform }}
4343

4444
steps:
45-
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
46-
with:
47-
go-version: ${{ matrix.go-version }}
4845
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
49-
50-
# Get values for cache paths to be used in later steps
51-
- id: cache-paths
52-
run: |
53-
echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
54-
echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
55-
56-
- name: Cache go modules
57-
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
46+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
5847
with:
59-
path: |
60-
${{ steps.cache-paths.outputs.go-cache }}
61-
${{ steps.cache-paths.outputs.go-mod-cache }}
62-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
63-
restore-keys: ${{ runner.os }}-go-
48+
go-version: ${{ matrix.go-version }}
49+
cache-dependency-path: "**/go.sum"
6450

6551
- name: Run go test
6652
run: |

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ vendor/
1919
# golangci-lint -v custom generates the following local file:
2020
custom-gcl
2121
custom-gcl.exe
22-
gen-iterators

.golangci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ linters:
1515
- godot
1616
- goheader
1717
- gosec
18+
- govet
1819
- intrange
1920
- misspell
2021
- modernize
@@ -65,6 +66,11 @@ linters:
6566
- G104
6667
# int(os.Stdin.Fd())
6768
- G115
69+
govet:
70+
enable-all: true
71+
disable:
72+
- fieldalignment
73+
- shadow
6874
misspell:
6975
locale: US
7076
# extra words from https://go.dev//wiki/Spelling

REVIEWERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
stevehipwell
22
alexandear
33
zyfy29
4+
Not-Dhananjay-Mishra

example/go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ require (
99
github.com/gofri/go-github-ratelimit/v2 v2.0.2
1010
github.com/google/go-github/v81 v81.0.0
1111
github.com/sigstore/sigstore-go v0.6.1
12-
golang.org/x/crypto v0.46.0
13-
golang.org/x/term v0.38.0
12+
golang.org/x/crypto v0.47.0
13+
golang.org/x/term v0.39.0
1414
google.golang.org/appengine v1.6.8
1515
)
1616

@@ -87,11 +87,11 @@ require (
8787
go.uber.org/multierr v1.11.0 // indirect
8888
go.uber.org/zap v1.27.0 // indirect
8989
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect
90-
golang.org/x/mod v0.30.0 // indirect
91-
golang.org/x/net v0.47.0 // indirect
90+
golang.org/x/mod v0.31.0 // indirect
91+
golang.org/x/net v0.48.0 // indirect
9292
golang.org/x/sync v0.19.0 // indirect
93-
golang.org/x/sys v0.39.0 // indirect
94-
golang.org/x/text v0.32.0 // indirect
93+
golang.org/x/sys v0.40.0 // indirect
94+
golang.org/x/text v0.33.0 // indirect
9595
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
9696
google.golang.org/protobuf v1.34.2 // indirect
9797
gopkg.in/ini.v1 v1.67.0 // indirect

example/go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,18 +355,18 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
355355
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
356356
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
357357
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
358-
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
359-
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
358+
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
359+
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
360360
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o=
361361
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
362362
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
363-
golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
364-
golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc=
363+
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
364+
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
365365
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
366366
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
367367
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
368-
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
369-
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
368+
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
369+
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
370370
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
371371
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
372372
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -378,18 +378,18 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
378378
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
379379
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
380380
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
381-
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
382-
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
381+
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
382+
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
383383
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
384384
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
385-
golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q=
386-
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
385+
golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY=
386+
golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww=
387387
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
388388
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
389389
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
390390
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
391-
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
392-
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
391+
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
392+
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
393393
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
394394
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
395395
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

github/enterprise_properties_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestEnterpriseService_GetAllCustomProperties(t *testing.T) {
5555
PropertyName: Ptr("name"),
5656
ValueType: PropertyValueTypeSingleSelect,
5757
Required: Ptr(true),
58-
DefaultValue: Ptr("production"),
58+
DefaultValue: "production",
5959
Description: Ptr("Prod or dev environment"),
6060
AllowedValues: []string{"production", "development"},
6161
ValuesEditableBy: Ptr("org_actors"),
@@ -178,7 +178,7 @@ func TestEnterpriseService_GetCustomProperty(t *testing.T) {
178178
PropertyName: Ptr("name"),
179179
ValueType: PropertyValueTypeSingleSelect,
180180
Required: Ptr(true),
181-
DefaultValue: Ptr("production"),
181+
DefaultValue: "production",
182182
Description: Ptr("Prod or dev environment"),
183183
AllowedValues: []string{"production", "development"},
184184
ValuesEditableBy: Ptr("org_actors"),
@@ -222,7 +222,7 @@ func TestEnterpriseService_CreateOrUpdateCustomProperty(t *testing.T) {
222222
property, _, err := client.Enterprise.CreateOrUpdateCustomProperty(ctx, "e", "name", &CustomProperty{
223223
ValueType: PropertyValueTypeSingleSelect,
224224
Required: Ptr(true),
225-
DefaultValue: Ptr("production"),
225+
DefaultValue: "production",
226226
Description: Ptr("Prod or dev environment"),
227227
AllowedValues: []string{"production", "development"},
228228
ValuesEditableBy: Ptr("org_actors"),
@@ -235,7 +235,7 @@ func TestEnterpriseService_CreateOrUpdateCustomProperty(t *testing.T) {
235235
PropertyName: Ptr("name"),
236236
ValueType: PropertyValueTypeSingleSelect,
237237
Required: Ptr(true),
238-
DefaultValue: Ptr("production"),
238+
DefaultValue: "production",
239239
Description: Ptr("Prod or dev environment"),
240240
AllowedValues: []string{"production", "development"},
241241
ValuesEditableBy: Ptr("org_actors"),

github/event_types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13732,7 +13732,7 @@ func TestCustomPropertyEvent_Marshal(t *testing.T) {
1373213732
ValueType: PropertyValueTypeSingleSelect,
1373313733
SourceType: Ptr("enterprise"),
1373413734
Required: Ptr(true),
13735-
DefaultValue: Ptr("production"),
13735+
DefaultValue: "production",
1373613736
Description: Ptr("Prod or dev environment"),
1373713737
AllowedValues: []string{"production", "development"},
1373813738
ValuesEditableBy: Ptr("org_actors"),

github/git_refs.go

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,31 +82,17 @@ func refURLEscape(ref string) string {
8282
return strings.Join(parts, "/")
8383
}
8484

85-
// ReferenceListOptions specifies optional parameters to the
86-
// GitService.ListMatchingRefs method.
87-
type ReferenceListOptions struct {
88-
// The ref must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags.
89-
Ref string `url:"-"`
90-
91-
ListOptions
92-
}
93-
9485
// ListMatchingRefs lists references in a repository that match a supplied ref.
86+
// The ref in the URL must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags.
87+
// If the ref doesn't exist in the repository, but existing refs start with ref, they will be returned as an array.
9588
// Use an empty ref to list all references.
9689
//
9790
// GitHub API docs: https://docs.github.com/rest/git/refs#list-matching-references
9891
//
9992
//meta:operation GET /repos/{owner}/{repo}/git/matching-refs/{ref}
100-
func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, opts *ReferenceListOptions) ([]*Reference, *Response, error) {
101-
var ref string
102-
if opts != nil {
103-
ref = strings.TrimPrefix(opts.Ref, "refs/")
104-
}
93+
func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo, ref string) ([]*Reference, *Response, error) {
94+
ref = strings.TrimPrefix(ref, "refs/") // API expects no "refs/" prefix
10595
u := fmt.Sprintf("repos/%v/%v/git/matching-refs/%v", owner, repo, refURLEscape(ref))
106-
u, err := addOptions(u, opts)
107-
if err != nil {
108-
return nil, nil, err
109-
}
11096

11197
req, err := s.client.NewRequest("GET", u, nil)
11298
if err != nil {

0 commit comments

Comments
 (0)