Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/google.golang.org/prot…
Browse files Browse the repository at this point in the history
…obuf-1.33.0
  • Loading branch information
nakamasato authored Jul 25, 2024
2 parents e88b387 + 2e0977f commit 05a75bc
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 64 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: actionlint

on:
pull_request:

jobs:
path-filter:
outputs:
workflows: ${{steps.changes.outputs.workflows}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
workflows:
- '.github/workflows/*'
status-check-actionlint:
runs-on: ubuntu-latest
needs:
- actionlint
permissions: {}
if: failure()
steps:
- run: exit 1

actionlint:
needs: path-filter
if: ${{ needs.path-filter.outputs.workflows == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
shell: bash
18 changes: 0 additions & 18 deletions .github/workflows/actionlintl.yml

This file was deleted.

38 changes: 33 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,49 @@ name: go

on:
pull_request:
paths:
- 'contents/kubernetes-operator/**.go'
- .github/workflows/go.yml
- '**go**'
push:
branches:
- main

jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
go: ${{ steps.filter.outputs.go }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
go:
- 'contents/kubernetes-operator/**.go'
- .github/workflows/go.yml
- '**go**'
status-check-go:
runs-on: ubuntu-latest
needs:
- test
- golangci-lint
permissions: {}
if: failure()
steps:
- run: exit 1

test:
needs: changes
if: ${{ needs.changes.outputs.go == 'true' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4

- name: setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: go.mod

Expand All @@ -30,6 +56,8 @@ jobs:
uses: codecov/codecov-action@v3

golangci-lint:
needs: changes
if: ${{ needs.changes.outputs.go == 'true' }}
runs-on: ubuntu-latest
steps:
- name: checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 'pypy3.9'
- uses: pre-commit/[email protected].0
- uses: pre-commit/[email protected].1
15 changes: 15 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
run:
timeout: 5m # default is 1m
issues:
exclude-rules:
- path: contents/kubernetes-operator/controller-runtime/
linters:
- errcheck

- path: contents/kubernetes-extensions/kubernetes-scheduler/random-scheduler
linters:
- errcheck

- path: contents/kubernetes-operator/client-go/
linters:
- errcheck
6 changes: 3 additions & 3 deletions contents/kubernetes-operator/client-go/indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ func exampleWithThreadSafeMap() {
}

func nameIndexer(obj interface{}) ([]string, error) {
switch obj.(type) {
switch v := obj.(type) {
case string:
return []string{obj.(string)}, nil
return []string{v}, nil
case User:
return []string{obj.(User).Name}, nil
return []string{v.Name}, nil
default:
return []string{}, errors.New("nameIndexer error")
}
Expand Down
22 changes: 10 additions & 12 deletions contents/kubernetes-operator/client-go/listerwatcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,17 @@ Code: You can get the event through `w.ResultChan()`. The example is simplified
}
loop:
for {
select {
case event, ok := <-w.ResultChan():
if !ok {
break loop
}

meta, err := meta.Accessor(event.Object)
if err != nil {
continue
}
resourceVersion := meta.GetResourceVersion()
klog.Infof("event: %s, resourceVersion: %s", event.Type, resourceVersion)
event, ok := <-w.ResultChan()
if !ok {
break loop
}

meta, err := meta.Accessor(event.Object)
if err != nil {
continue
}
resourceVersion := meta.GetResourceVersion()
klog.Infof("event: %s, resourceVersion: %s", event.Type, resourceVersion)
}
```

Expand Down
20 changes: 9 additions & 11 deletions contents/kubernetes-operator/client-go/listerwatcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,16 @@ func main() {
}
loop:
for {
select {
case event, ok := <-w.ResultChan():
if !ok {
break loop
}
event, ok := <-w.ResultChan()
if !ok {
break loop
}

meta, err := meta.Accessor(event.Object)
if err != nil {
continue
}
resourceVersion := meta.GetResourceVersion()
klog.Infof("event: %s, resourceVersion: %s", event.Type, resourceVersion)
meta, err := meta.Accessor(event.Object)
if err != nil {
continue
}
resourceVersion := meta.GetResourceVersion()
klog.Infof("event: %s, resourceVersion: %s", event.Type, resourceVersion)
}
}
3 changes: 1 addition & 2 deletions doc/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package doc

import (
"fmt"
"io/ioutil"
"os"
"strings"
)
Expand Down Expand Up @@ -103,7 +102,7 @@ func (m *MarkDownDoc) WriteTable(t *Table) *MarkDownDoc {
}

func (m *MarkDownDoc) Export(filename string) error {
return ioutil.WriteFile(filename, []byte(m.builder.String()), os.ModePerm)
return os.WriteFile(filename, []byte(m.builder.String()), os.ModePerm)
}

func (m *MarkDownDoc) GetLink(desc, url string) string {
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8=
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -152,16 +152,16 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down

0 comments on commit 05a75bc

Please sign in to comment.