File tree 3 files changed +17
-9
lines changed
3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -141,10 +141,14 @@ buildtag analyzer.
141
141
142
142
## ** embed**
143
143
144
- check for //go: embed directive import
144
+ check //go: embed directive usage
145
145
146
- This analyzer checks that the embed package is imported when source code contains //go: embed comment directives.
147
- The embed package must be imported for //go: embed directives to function.import _ "embed".
146
+ This analyzer checks that the embed package is imported if //go: embed
147
+ directives are present, providing a suggested fix to add the import if
148
+ it is missing.
149
+
150
+ This analyzer also checks that //go: embed directives precede the
151
+ declaration of a single variable.
148
152
149
153
** Enabled by default.**
150
154
Original file line number Diff line number Diff line change 3
3
// license that can be found in the LICENSE file.
4
4
5
5
// Package embeddirective defines an Analyzer that validates //go:embed directives.
6
- // The analyzer defers fixes to it's parent source.Analyzer.
6
+ // The analyzer defers fixes to its parent source.Analyzer.
7
7
package embeddirective
8
8
9
9
import (
@@ -14,10 +14,14 @@ import (
14
14
"golang.org/x/tools/go/analysis"
15
15
)
16
16
17
- const Doc = `check for //go:embed directive import
17
+ const Doc = `check //go:embed directive usage
18
18
19
- This analyzer checks that the embed package is imported when source code contains //go:embed comment directives.
20
- The embed package must be imported for //go:embed directives to function.import _ "embed".`
19
+ This analyzer checks that the embed package is imported if //go:embed
20
+ directives are present, providing a suggested fix to add the import if
21
+ it is missing.
22
+
23
+ This analyzer also checks that //go:embed directives precede the
24
+ declaration of a single variable.`
21
25
22
26
var Analyzer = & analysis.Analyzer {
23
27
Name : "embed" ,
You can’t perform that action at this time.
0 commit comments