Skip to content

go1.7 vet flags "possible formatting directive" when Error is used #339

@prashantv

Description

@prashantv

When the assert.Error method is used with formatting arguments, go vet complains as of 1.7:

flag_test.go:61: possible formatting directive in Error call

For more information and a repro, see:
uber-go/zap#135

The specific check that is run is here:
https://golang.org/src/cmd/vet/print.go#L587

I'm not sure if there's a good fix for this, but I wanted to flag this, as I typically:

  • recommend adding context to the assert.Error calls
  • suggest usage of assert.Error instead of assert.NotNil

However, this "correct" usage of the library leading to a vet failure may mean users will either avoid one or the other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions