Skip to content

Commit

Permalink
add golangci badge, and fix some lint issues found by the tool
Browse files Browse the repository at this point in the history
  • Loading branch information
alexflint committed Apr 4, 2019
1 parent 57836b8 commit 6b4ab73
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![GoDoc](https://godoc.org/github.com/alexflint/go-arg?status.svg)](https://godoc.org/github.com/alexflint/go-arg)
[![Build Status](https://travis-ci.org/alexflint/go-arg.svg?branch=master)](https://travis-ci.org/alexflint/go-arg)
[![GolangCI](https://golangci.com/badges/github.com/alexflint/go-arg.svg)](https://golangci.com)
[![Coverage Status](https://coveralls.io/repos/alexflint/go-arg/badge.svg?branch=master&service=github)](https://coveralls.io/github/alexflint/go-arg?branch=master)
[![Report Card](https://goreportcard.com/badge/github.com/alexflint/go-arg)](https://goreportcard.com/badge/github.com/alexflint/go-arg)

Expand Down
4 changes: 2 additions & 2 deletions parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,14 @@ func TestHelpFlag(t *testing.T) {
func TestPanicOnNonPointer(t *testing.T) {
var args struct{}
assert.Panics(t, func() {
parse("", args)
_ = parse("", args)
})
}

func TestPanicOnNonStruct(t *testing.T) {
var args string
assert.Panics(t, func() {
parse("", &args)
_ = parse("", &args)
})
}

Expand Down
1 change: 1 addition & 0 deletions test/some-program/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ func main() {
Test string
}
arg.MustParse(&args)
_ = args.Test
}
34 changes: 15 additions & 19 deletions usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package arg

import (
"bytes"
"errors"
"fmt"
"os"
"strings"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"strings"
"fmt"
"errors"
)

type NameDotName struct {
Expand Down Expand Up @@ -56,16 +56,16 @@ Options:
--help, -h display this help and exit
`
var args struct {
Input string `arg:"positional"`
Output []string `arg:"positional" help:"list of outputs"`
Name string `help:"name to use"`
Value int `help:"secret value"`
Verbose bool `arg:"-v" help:"verbosity level"`
Dataset string `help:"dataset to use"`
Optimize int `arg:"-O" help:"optimization level"`
Ids []int64 `help:"Ids"`
Values []float64 `help:"Values"`
Workers int `arg:"-w,env:WORKERS" help:"number of workers to start"`
Input string `arg:"positional"`
Output []string `arg:"positional" help:"list of outputs"`
Name string `help:"name to use"`
Value int `help:"secret value"`
Verbose bool `arg:"-v" help:"verbosity level"`
Dataset string `help:"dataset to use"`
Optimize int `arg:"-O" help:"optimization level"`
Ids []int64 `help:"Ids"`
Values []float64 `help:"Values"`
Workers int `arg:"-w,env:WORKERS" help:"number of workers to start"`
File *NameDotName `arg:"-f" help:"File with mandatory extension"`
}
args.Name = "Foo Bar"
Expand All @@ -89,15 +89,11 @@ Options:
type MyEnum int

func (n *MyEnum) UnmarshalText(b []byte) error {
b = []byte("Hello")
return nil
}

func (n *MyEnum) MarshalText() (text []byte, err error) {
s := "There was a problem"
text = []byte(s)
err = errors.New(s)
return
func (n *MyEnum) MarshalText() ([]byte, error) {
return nil, errors.New("There was a problem")
}

func TestUsageError(t *testing.T) {
Expand Down

0 comments on commit 6b4ab73

Please sign in to comment.