Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common functions found in hollow root commands #60

Merged
merged 10 commits into from
Oct 14, 2022
4 changes: 2 additions & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: '1.19'

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3

with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.45
version: v1.50

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage.txt
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ linters-settings:
linters:
enable:
# default linters
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

# additional linters
- bodyclose
Expand Down
4 changes: 2 additions & 2 deletions ginauth/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"time"

Expand Down Expand Up @@ -87,7 +87,7 @@ func (rm *RemoteMiddleware) VerifyTokenWithScopes(c *gin.Context, scopes []strin

defer resp.Body.Close()

body, readerr := ioutil.ReadAll(resp.Body)
body, readerr := io.ReadAll(resp.Body)
if readerr != nil {
return ClaimMetadata{}, fmt.Errorf("%w: %s", ErrMiddlewareRemote, readerr)
}
Expand Down
6 changes: 3 additions & 3 deletions ginjwt/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Claims struct {
//
// A call to this would normally look as follows:
//
// ginjwt.RegisterViperOIDCFlags(viper.GetViper(), serveCmd)
// ginjwt.RegisterViperOIDCFlags(viper.GetViper(), serveCmd)
//
// The oidc configuration should be passed in through a yaml file due to the nested
// structure of the fields, however, if only one oidc provider is used the flag parameters would work.
Expand Down Expand Up @@ -73,7 +73,7 @@ func RegisterViperOIDCFlags(v *viper.Viper, cmd *cobra.Command) {
//
// A call to this would normally look as follows:
//
// ginjwt.GetAuthConfigFromFlags(viper.GetViper())
// ginjwt.GetAuthConfigFromFlags(viper.GetViper())
//
// Note that when using this function configuration
func GetAuthConfigFromFlags(v *viper.Viper) (AuthConfig, error) {
Expand Down Expand Up @@ -118,7 +118,7 @@ func GetAuthConfigFromFlags(v *viper.Viper) (AuthConfig, error) {
//
// A call to this would normally look as follows:
//
// ginjwt.GetAuthConfigsFromFlags(viper.GetViper())
// ginjwt.GetAuthConfigsFromFlags(viper.GetViper())
//
// Note that this function will retrieve as many AuthConfigs as the number
// of issuers and JWK URIs given (which must match)
Expand Down
29 changes: 17 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,48 @@ go 1.19

require (
github.com/gin-gonic/gin v1.8.1
github.com/spf13/cobra v1.5.0
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.6.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.13.0
github.com/stretchr/testify v1.8.0
golang.org/x/net v0.0.0-20221004154528-8021a29435af
go.uber.org/zap v1.23.0
golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458
gopkg.in/square/go-jose.v2 v2.6.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/goccy/go-json v0.9.11 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.0.0-20221012134737-56aed061732a // indirect
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 // indirect
golang.org/x/text v0.3.8 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading