aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golangci/unconvert/README
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-07-04 11:12:55 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-04 15:05:30 +0200
commitc7d7f10bdff703e4a3c0414e8a33d4e45c91eb35 (patch)
tree0dff0ee1f98dbfa3ad8776112053a450d176592b /vendor/github.com/golangci/unconvert/README
parent9573094ce235bd9afe88f5da27a47dd6bcc1e13b (diff)
go.mod: vendor golangci-lint
Diffstat (limited to 'vendor/github.com/golangci/unconvert/README')
-rw-r--r--vendor/github.com/golangci/unconvert/README36
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/github.com/golangci/unconvert/README b/vendor/github.com/golangci/unconvert/README
new file mode 100644
index 000000000..dbaea4f57
--- /dev/null
+++ b/vendor/github.com/golangci/unconvert/README
@@ -0,0 +1,36 @@
+About:
+
+The unconvert program analyzes Go packages to identify unnecessary
+type conversions; i.e., expressions T(x) where x already has type T.
+
+Install:
+
+ $ go get github.com/mdempsky/unconvert
+
+Usage:
+
+ $ unconvert -v bytes fmt
+ GOROOT/src/bytes/reader.go:117:14: unnecessary conversion
+ abs = int64(r.i) + offset
+ ^
+ GOROOT/src/fmt/print.go:411:21: unnecessary conversion
+ p.fmt.integer(int64(v), 16, unsigned, udigits)
+ ^
+
+Flags:
+
+Using the -v flag, unconvert will also print the source line and a
+caret to indicate the unnecessary conversion's position therein.
+
+Using the -apply flag, unconvert will rewrite the Go source files
+without the unnecessary type conversions.
+
+Using the -all flag, unconvert will analyze the Go packages under all
+possible GOOS/GOARCH combinations, and only identify conversions that
+are unnecessary in all cases.
+
+E.g., syscall.Timespec's Sec and Nsec fields are int64 under
+linux/amd64 but int32 under linux/386. An int64(ts.Sec) conversion
+that appears in a linux/amd64-only file will be identified as
+unnecessary, but it will be preserved if it occurs in a file that's
+compiled for both linux/amd64 and linux/386.