github.com/ianlancetaylor/demangle v0.0.0-20180524225900-fc6590592b44 // indirect
golang.org/x/arch v0.0.0-20190815191158-8a70ba74b3a1
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
- golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee
+ golang.org/x/mod v0.1.1-0.20191126161957-788aebd06792
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 // indirect
- golang.org/x/tools v0.0.0-20191104222624-6b7b8b79ae80
+ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
)
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
-golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/mod v0.1.1-0.20191126161957-788aebd06792 h1:04Uqz7R2BD7irAGgQtrKNW5tLa50RgSW71y4ofoaivk=
+golang.org/x/mod v0.1.1-0.20191126161957-788aebd06792/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/tools v0.0.0-20191104222624-6b7b8b79ae80 h1:6CcDC1SXj4DrJP955osT9RJmKsH3LQBZJ59D5v4Rw0s=
-golang.org/x/tools v0.0.0-20191104222624-6b7b8b79ae80/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e h1:aZzprAO9/8oim3qStq3wc1Xuxx4QmAGriC4VU4ojemQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
if len(line.Suffix) == 0 {
return false
}
- f := strings.Fields(line.Suffix[0].Token)
- return (len(f) == 2 && f[1] == "indirect" || len(f) > 2 && f[1] == "indirect;") && f[0] == "//"
+ f := strings.Fields(strings.TrimPrefix(line.Suffix[0].Token, string(slashSlash)))
+ return (len(f) == 1 && f[0] == "indirect" || len(f) > 1 && f[0] == "indirect;")
}
// setIndirect sets line to have (or not have) a "// indirect" comment.
line.Suffix = []Comment{{Token: "// indirect", Suffix: true}}
return
}
- // Insert at beginning of existing comment.
+
com := &line.Suffix[0]
- space := " "
- if len(com.Token) > 2 && com.Token[2] == ' ' || com.Token[2] == '\t' {
- space = ""
+ text := strings.TrimSpace(strings.TrimPrefix(com.Token, string(slashSlash)))
+ if text == "" {
+ // Empty comment.
+ com.Token = "// indirect"
+ return
}
- com.Token = "// indirect;" + space + com.Token[2:]
+
+ // Insert at beginning of existing comment.
+ com.Token = "// indirect; " + text
return
}
Version string `json:",omitempty"`
}
-// String returns the module version syntax Path@Version.
+// String returns a representation of the Version suitable for logging
+// (Path@Version, or just Path if Version is empty).
func (m Version) String() string {
+ if m.Version == "" {
+ return m.Path
+ }
return m.Path + "@" + m.Version
}
// belong in the module zip. In particular, CreateFromDir will not include
// files in modules found in subdirectories, most files in vendor directories,
// or irregular files (such as symbolic links) in the output archive.
+// Additionally, unlike Create, CreateFromDir will not include directories
+// named ".bzr", ".git", ".hg", or ".svn".
func CreateFromDir(w io.Writer, m module.Version, dir string) (err error) {
defer func() {
if zerr, ok := err.(*zipError); ok {
return nil
}
+ // Skip VCS directories.
+ // fossil repos are regular files with arbitrary names, so we don't try
+ // to exclude them.
+ switch filepath.Base(filePath) {
+ case ".bzr", ".git", ".hg", ".svn":
+ return filepath.SkipDir
+ }
+
// Skip some subdirectories inside vendor, but maintain bug
// golang.org/issue/31562, described in isVendoredPackage.
// We would like Create and CreateFromDir to produce the same result
"golang.org/x/tools/go/analysis/passes/internal/analysisutil"
)
+const Doc = "report mismatches between assembly files and Go declarations"
+
var Analyzer = &analysis.Analyzer{
Name: "asmdecl",
- Doc: "report mismatches between assembly files and Go declarations",
+ Doc: Doc,
Run: run,
}
"golang.org/x/tools/go/ast/inspector"
)
+const Doc = "check for common mistakes involving boolean operators"
+
var Analyzer = &analysis.Analyzer{
Name: "bools",
- Doc: "check for common mistakes involving boolean operators",
+ Doc: Doc,
Requires: []*analysis.Analyzer{inspect.Analyzer},
Run: run,
}
"golang.org/x/tools/go/analysis/passes/internal/analysisutil"
)
+const Doc = "check that +build tags are well-formed and correctly located"
+
var Analyzer = &analysis.Analyzer{
Name: "buildtag",
- Doc: "check that +build tags are well-formed and correctly located",
+ Doc: Doc,
Run: runBuildTag,
}
const debug = false
-const doc = `detect some violations of the cgo pointer passing rules
+const Doc = `detect some violations of the cgo pointer passing rules
Check for invalid cgo pointer passing.
This looks for code that uses cgo to call C code passing values
var Analyzer = &analysis.Analyzer{
Name: "cgocall",
- Doc: doc,
+ Doc: Doc,
RunDespiteErrors: true,
Run: run,
}
"golang.org/x/tools/go/types/typeutil"
)
-const doc = `report passing non-pointer or non-error values to errors.As
+const Doc = `report passing non-pointer or non-error values to errors.As
The errorsas analysis reports calls to errors.As where the type
of the second argument is not a pointer to a type implementing error.`
var Analyzer = &analysis.Analyzer{
Name: "errorsas",
- Doc: doc,
+ Doc: Doc,
Requires: []*analysis.Analyzer{inspect.Analyzer},
Run: run,
}
// license that can be found in the LICENSE file.
// Package lostcancel defines an Analyzer that checks for failure to
-// call a context cancelation function.
+// call a context cancellation function.
package lostcancel
import (
const Doc = `check cancel func returned by context.WithCancel is called
-The cancelation function returned by context.WithCancel, WithTimeout,
+The cancellation function returned by context.WithCancel, WithTimeout,
and WithDeadline must be called or the new context will remain live
until its parent context is cancelled.
(The background context is never cancelled.)`
var Analyzer = &analysis.Analyzer{
Name: "printf",
- Doc: doc,
+ Doc: Doc,
Requires: []*analysis.Analyzer{inspect.Analyzer},
Run: run,
ResultType: reflect.TypeOf((*Result)(nil)),
FactTypes: []analysis.Fact{new(isWrapper)},
}
-const doc = `check consistency of Printf format strings and arguments
+const Doc = `check consistency of Printf format strings and arguments
The check applies to known functions (for example, those in package fmt)
as well as any detected wrappers of known functions.
"golang.org/x/tools/go/ast/inspector"
)
+const Doc = "check for shifts that equal or exceed the width of the integer"
+
var Analyzer = &analysis.Analyzer{
Name: "shift",
- Doc: "check for shifts that equal or exceed the width of the integer",
+ Doc: Doc,
Requires: []*analysis.Analyzer{inspect.Analyzer},
Run: run,
}
"golang.org/x/tools/go/types/typeutil"
)
-const doc = `report passing non-pointer or non-interface values to unmarshal
+const Doc = `report passing non-pointer or non-interface values to unmarshal
The unmarshal analysis reports calls to functions such as json.Unmarshal
in which the argument type is not a pointer or an interface.`
var Analyzer = &analysis.Analyzer{
Name: "unmarshal",
- Doc: doc,
+ Doc: Doc,
Requires: []*analysis.Analyzer{inspect.Analyzer},
Run: run,
}
golang.org/x/crypto/ed25519
golang.org/x/crypto/ed25519/internal/edwards25519
golang.org/x/crypto/ssh/terminal
-# golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee
+# golang.org/x/mod v0.1.1-0.20191126161957-788aebd06792
## explicit
golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/modfile
## explicit
golang.org/x/sys/unix
golang.org/x/sys/windows
-# golang.org/x/tools v0.0.0-20191104222624-6b7b8b79ae80
+# golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
## explicit
golang.org/x/tools/go/analysis
golang.org/x/tools/go/analysis/internal/analysisflags