This repository was archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 609
fix several linting warnings #374
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,6 @@ changelog: | |
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- 'README' | ||
- '^docs:' | ||
- '^test:' | ||
- 'README' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,7 +158,7 @@ func parseMockNames(names string) map[string]string { | |
} | ||
|
||
func usage() { | ||
io.WriteString(os.Stderr, usageText) | ||
_, _ = io.WriteString(os.Stderr, usageText) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Being explicit. |
||
flag.PrintDefaults() | ||
} | ||
|
||
|
@@ -305,14 +305,14 @@ func (g *generator) Generate(pkg *model.Package, pkgName string, outputPackagePa | |
g.p("") | ||
g.p("import (") | ||
g.in() | ||
for path, pkg := range g.packageMap { | ||
if path == outputPackagePath { | ||
for pkgPath, pkg := range g.packageMap { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We import |
||
if pkgPath == outputPackagePath { | ||
continue | ||
} | ||
g.p("%v %q", pkg, path) | ||
g.p("%v %q", pkg, pkgPath) | ||
} | ||
for _, path := range pkg.DotImports { | ||
g.p(". %q", path) | ||
for _, pkgPath := range pkg.DotImports { | ||
g.p(". %q", pkgPath) | ||
} | ||
g.out() | ||
g.p(")") | ||
|
@@ -357,9 +357,9 @@ func (g *generator) GenerateMockInterface(intf *model.Interface, outputPackagePa | |
g.p("") | ||
|
||
// TODO: Re-enable this if we can import the interface reliably. | ||
//g.p("// Verify that the mock satisfies the interface at compile time.") | ||
//g.p("var _ %v = (*%v)(nil)", typeName, mockType) | ||
//g.p("") | ||
// g.p("// Verify that the mock satisfies the interface at compile time.") | ||
// g.p("var _ %v = (*%v)(nil)", typeName, mockType) | ||
// g.p("") | ||
|
||
g.p("// New%v creates a new mock instance", mockType) | ||
g.p("func New%v(ctrl *gomock.Controller) *%v {", mockType, mockType) | ||
|
@@ -387,9 +387,9 @@ func (g *generator) GenerateMockInterface(intf *model.Interface, outputPackagePa | |
func (g *generator) GenerateMockMethods(mockType string, intf *model.Interface, pkgOverride string) { | ||
for _, m := range intf.Methods { | ||
g.p("") | ||
g.GenerateMockMethod(mockType, m, pkgOverride) | ||
_ = g.GenerateMockMethod(mockType, m, pkgOverride) | ||
g.p("") | ||
g.GenerateMockRecorderMethod(mockType, m) | ||
_ = g.GenerateMockRecorderMethod(mockType, m) | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ type Package struct { | |
|
||
// Print writes the package name and its exported interfaces. | ||
func (pkg *Package) Print(w io.Writer) { | ||
fmt.Fprintf(w, "package %s\n", pkg.Name) | ||
_, _ = fmt.Fprintf(w, "package %s\n", pkg.Name) | ||
for _, intf := range pkg.Interfaces { | ||
intf.Print(w) | ||
} | ||
|
@@ -58,7 +58,7 @@ type Interface struct { | |
|
||
// Print writes the interface name and its methods. | ||
func (intf *Interface) Print(w io.Writer) { | ||
fmt.Fprintf(w, "interface %s\n", intf.Name) | ||
_, _ = fmt.Fprintf(w, "interface %s\n", intf.Name) | ||
for _, m := range intf.Methods { | ||
m.Print(w) | ||
} | ||
|
@@ -79,19 +79,19 @@ type Method struct { | |
|
||
// Print writes the method name and its signature. | ||
func (m *Method) Print(w io.Writer) { | ||
fmt.Fprintf(w, " - method %s\n", m.Name) | ||
_, _ = fmt.Fprintf(w, " - method %s\n", m.Name) | ||
if len(m.In) > 0 { | ||
fmt.Fprintf(w, " in:\n") | ||
_, _ = fmt.Fprintf(w, " in:\n") | ||
for _, p := range m.In { | ||
p.Print(w) | ||
} | ||
} | ||
if m.Variadic != nil { | ||
fmt.Fprintf(w, " ...:\n") | ||
_, _ = fmt.Fprintf(w, " ...:\n") | ||
m.Variadic.Print(w) | ||
} | ||
if len(m.Out) > 0 { | ||
fmt.Fprintf(w, " out:\n") | ||
_, _ = fmt.Fprintf(w, " out:\n") | ||
for _, p := range m.Out { | ||
p.Print(w) | ||
} | ||
|
@@ -122,7 +122,7 @@ func (p *Parameter) Print(w io.Writer) { | |
if n == "" { | ||
n = `""` | ||
} | ||
fmt.Fprintf(w, " - %v: %v\n", n, p.Type.String(nil, "")) | ||
_, _ = fmt.Fprintf(w, " - %v: %v\n", n, p.Type.String(nil, "")) | ||
} | ||
|
||
// Type is a Go type. | ||
|
@@ -264,6 +264,7 @@ func (nt *NamedType) String(pm map[string]string, pkgOverride string) string { | |
|
||
return nt.Type | ||
} | ||
|
||
func (nt *NamedType) addImports(im map[string]bool) { | ||
if nt.Package != "" { | ||
im[nt.Package] = true | ||
|
@@ -283,8 +284,8 @@ func (pt *PointerType) addImports(im map[string]bool) { pt.Type.addImports(im) } | |
// PredeclaredType is a predeclared type such as "int". | ||
type PredeclaredType string | ||
|
||
func (pt PredeclaredType) String(pm map[string]string, pkgOverride string) string { return string(pt) } | ||
func (pt PredeclaredType) addImports(im map[string]bool) {} | ||
func (pt PredeclaredType) String(map[string]string, string) string { return string(pt) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If none of the parameters are used, don't name them. |
||
func (pt PredeclaredType) addImports(map[string]bool) {} | ||
|
||
// The following code is intended to be called by the program generated by ../reflect.go. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error
s should not start with a capital letter