Skip to content

Commit

Permalink
CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottKGregory committed Feb 28, 2021
1 parent d0272e2 commit 2682547
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 70 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ go:
- 1.16.x
git:
depth: 1
notifications:
email: false
slack:
secure: qg1KUWFZTGXvPgPiR85XMOi85Uw5q0luEUel0zFWk4UxpFX64khpvvnhFhQCyugZxFyCKwxWXW2oc6gD40X+jCvGYUhBBIl91jabwwR9hZ9ZkmPbkm0/ABVpsOUO9bBnrP4iVWQeyVHw7HdxFenCEA2wtlelSVkj8ItYjo5VnMWiUbl1idUca8KmVVHaKPjU/Fp9xDduisJozFOrbuCnpQUmubko5S3cIN5TsWwBpMMAa2eKSmWrXP9hpP3+znOjbrrJCpEuZbwRUu3JcReogLVbzmvwTNzLYnzoh97/stxzZVxxvM7EI3SBjuVYqFrdHW/3xk+nFBPYfrGsvFoS/yftbeRHj18yYf0GQBqF0/yBTDMet6fBlL92KoG9f2WQF/pqkWo6CdE+yLCKTLPiwQwzlurN6eONsEVrTerlILtxGbcyoRtEvLAvNPj5k0t2iQ322DkqD2vSDkImaItBsFKMXrh1FblTDreeFMOfDZbV2rg1OLInkxcl2PQQZPvSHDK5eQHPReEgU3AHJU/8oKey80x74UcVFL9Ge9DGiCi4Yg9vKWma3crJZtrw0Pkx1NqNMS1RlGNGTkMQH7L7pApcSdBdKWTe4C/sOyC/D4RoSpMHzC2ErLWKNWTTzt4TUoytKDKW331b5cCWKEg3RtAzoWENB2XcgmgVSQQtIY4=
before_script:
- go install github.com/golangci/golangci-lint/cmd/golangci-lint
before_install:
- curl -sSfL https://github.com/raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.37.1
script:
- golangci-lint run
- go test -v -race ./...
10 changes: 5 additions & 5 deletions binder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (
"github.com/spf13/viper"
)

type Bindr struct {
type Binder struct {
log zerolog.Logger
}

// Bind binds the config tags from the structs and binds flags to the cobra command.
func Bind(obj interface{}, cmd *cobra.Command, options ...*Options) error {
p := &Bindr{}
p := &Binder{}

if len(options) == 1 {
opts := options[0]
Expand All @@ -34,7 +34,7 @@ func Bind(obj interface{}, cmd *cobra.Command, options ...*Options) error {
return p.processFields("", reflect.TypeOf(obj), cmd)
}

func (p *Bindr) processFields(prefix string, t reflect.Type, cmd *cobra.Command) error {
func (p *Binder) processFields(prefix string, t reflect.Type, cmd *cobra.Command) error {
for i := 0; i < t.NumField(); i++ {
err := p.processField(prefix, t.Field(i), cmd)
if err != nil {
Expand All @@ -45,7 +45,7 @@ func (p *Bindr) processFields(prefix string, t reflect.Type, cmd *cobra.Command)
return nil
}

func (p *Bindr) processField(prefix string, field reflect.StructField, cmd *cobra.Command) error {
func (p *Binder) processField(prefix string, field reflect.StructField, cmd *cobra.Command) error {
n := strings.ToLower(field.Name)
if prefix != "" {
n = fmt.Sprintf("%s.%s", prefix, strings.ToLower(field.Name))
Expand Down Expand Up @@ -234,7 +234,7 @@ type JSONStruct struct {
BoolArray []bool `json:"boolarray,omitempty"`
}

func (p *Bindr) processSlice(n, def, desc string, field reflect.StructField, cmd *cobra.Command) (err error) {
func (p *Binder) processSlice(n, def, desc string, field reflect.StructField, cmd *cobra.Command) (err error) {
s := &JSONStruct{}
switch field.Type.Elem().Kind() {
case reflect.Int:
Expand Down
Loading

0 comments on commit 2682547

Please sign in to comment.