Merge pull request #84 from sbezverk/error_wrap

Replace %v with %w to wrap netlink error
This commit is contained in:
Michael Stapelberg 2019-12-22 11:43:06 +01:00 committed by GitHub
commit 7a7d417622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -5,14 +5,14 @@ dist: trusty
language: go
go:
- "1.10"
- "1.13"
script:
# Check whether files are syntactically correct.
- "gofmt -l $(find . -name '*.go' | tr '\\n' ' ') >/dev/null"
# Check whether files were not gofmt'ed.
- "gosrc=$(find . -name '*.go' | tr '\\n' ' '); [ $(gofmt -l $gosrc 2>&- | wc -l) -eq 0 ] || (echo 'gofmt was not run on these files:'; gofmt -l $gosrc 2>&-; false)"
- go tool vet .
- go vet .
- go test ./...
- go test -c github.com/google/nftables
- sudo ./nftables.test -test.v -run_system_tests

View File

@ -57,11 +57,11 @@ func (cc *Conn) Flush() error {
defer conn.Close()
if _, err := conn.SendMessages(batch(cc.messages)); err != nil {
return fmt.Errorf("SendMessages: %v", err)
return fmt.Errorf("SendMessages: %w", err)
}
if _, err := conn.Receive(); err != nil {
return fmt.Errorf("Receive: %v", err)
return fmt.Errorf("Receive: %w", err)
}
cc.messages = nil