forked from mdempsky/unconvert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
30 lines (21 loc) · 932 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 bytes
GOROOT/src/bytes/reader.go:117:14:
abs = int64(r.i) + offset
^
Flags:
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.