Skip to content

Commit

Permalink
gometalinter should cover all packages
Browse files Browse the repository at this point in the history
  • Loading branch information
vektah committed Jul 8, 2018
1 parent ce65704 commit 61f3717
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
- run: go generate ./... && if [[ $(git --no-pager diff) ]] ; then echo "you need to run go generate" ; git --no-pager diff ; exit 1 ; fi
- run: go vet ./...
- run: go test -race ./...
- run: gometalinter ./example/... ./codegen/... ./handler/...
- run: gometalinter --vendor ./...

18 changes: 6 additions & 12 deletions client/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ import (
)

const (
connectionInitMsg = "connection_init" // Client -> Server
connectionTerminateMsg = "connection_terminate" // Client -> Server
startMsg = "start" // Client -> Server
stopMsg = "stop" // Client -> Server
connectionAckMsg = "connection_ack" // Server -> Client
connectionErrorMsg = "connection_error" // Server -> Client
connectionKeepAliveMsg = "ka" // Server -> Client
dataMsg = "data" // Server -> Client
errorMsg = "error" // Server -> Client
completeMsg = "complete" // Server -> Client
connectionInitMsg = "connection_init" // Client -> Server
startMsg = "start" // Client -> Server
connectionAckMsg = "connection_ack" // Server -> Client
dataMsg = "data" // Server -> Client
)

type operationMessage struct {
Expand Down Expand Up @@ -62,7 +56,7 @@ func (p *Client) Websocket(query string, options ...Option) *Subscription {
}

var ack operationMessage
if err := c.ReadJSON(&ack); err != nil {
if err = c.ReadJSON(&ack); err != nil {
return errorSubscription(fmt.Errorf("ack: %s", err.Error()))
}
if ack.Type != connectionAckMsg {
Expand Down Expand Up @@ -90,7 +84,7 @@ func (p *Client) Websocket(query string, options ...Option) *Subscription {

if respDataRaw["errors"] != nil {
var errs []*errors.QueryError
if err := unpack(respDataRaw["errors"], errs); err != nil {
if err = unpack(respDataRaw["errors"], errs); err != nil {
return err
}
if len(errs) > 0 {
Expand Down
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ func main() {
}
config.SchemaStr = string(schemaRaw)

if err := config.Check(); err != nil {
if err = config.Check(); err != nil {
fmt.Fprintln(os.Stderr, "invalid config format: "+err.Error())
os.Exit(1)
}

if emitYamlGuidance {
b, err := yaml.Marshal(config)
var b []byte
b, err = yaml.Marshal(config)
if err != nil {
fmt.Fprintln(os.Stderr, "unable to marshal yaml: "+err.Error())
os.Exit(1)
Expand Down

0 comments on commit 61f3717

Please sign in to comment.