Merge pull request #248 from fkautz/pr_out_renaming_package_to_gopackage_to_fix_golint_error

master
Frederick F. Kautz IV 10 years ago
commit ae9a0ea6fb
  1. 22
      buildscripts/verifier.go
  2. 2
      pkg/api/minioapi/definitions.go

@ -31,7 +31,7 @@ func errorf(format string, args ...interface{}) {
exitCode = 2 exitCode = 2
} }
type Package struct { type goPackage struct {
p *ast.Package p *ast.Package
fs *token.FileSet fs *token.FileSet
decl map[string]ast.Node decl map[string]ast.Node
@ -39,7 +39,7 @@ type Package struct {
used map[string]bool used map[string]bool
} }
type usedWalker Package type usedWalker goPackage
// Walks through the AST marking used identifiers. // Walks through the AST marking used identifiers.
func (p *usedWalker) Visit(node ast.Node) ast.Visitor { func (p *usedWalker) Visit(node ast.Node) ast.Visitor {
@ -51,23 +51,23 @@ func (p *usedWalker) Visit(node ast.Node) ast.Visitor {
return p return p
} }
type Report struct { type report struct {
pos token.Pos pos token.Pos
name string name string
} }
type Reports []Report type reports []report
// Len // Len
func (l Reports) Len() int { return len(l) } func (l reports) Len() int { return len(l) }
// Less // Less
func (l Reports) Less(i, j int) bool { return l[i].pos < l[j].pos } func (l reports) Less(i, j int) bool { return l[i].pos < l[j].pos }
// Swap // Swap
func (l Reports) Swap(i, j int) { l[i], l[j] = l[j], l[i] } func (l reports) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
// Visits files for used nodes. // Visits files for used nodes.
func (p *Package) Visit(node ast.Node) ast.Visitor { func (p *goPackage) Visit(node ast.Node) ast.Visitor {
u := usedWalker(*p) // hopefully p fields are references. u := usedWalker(*p) // hopefully p fields are references.
switch n := node.(type) { switch n := node.(type) {
// don't walk whole file, but only: // don't walk whole file, but only:
@ -129,7 +129,7 @@ func doDir(name string) {
} }
func doPackage(fs *token.FileSet, pkg *ast.Package) { func doPackage(fs *token.FileSet, pkg *ast.Package) {
p := &Package{ p := &goPackage{
p: pkg, p: pkg,
fs: fs, fs: fs,
decl: make(map[string]ast.Node), decl: make(map[string]ast.Node),
@ -200,10 +200,10 @@ func doPackage(fs *token.FileSet, pkg *ast.Package) {
} }
// reports. // reports.
reports := Reports(nil) reports := reports(nil)
for name, node := range p.decl { for name, node := range p.decl {
if !p.used[name] { if !p.used[name] {
reports = append(reports, Report{node.Pos(), name}) reports = append(reports, report{node.Pos(), name})
} }
} }
sort.Sort(reports) sort.Sort(reports)

@ -25,7 +25,7 @@ const (
maxObjectList = 1000 maxObjectList = 1000
) )
// Object list response format // ObjectListResponse format
type ObjectListResponse struct { type ObjectListResponse struct {
XMLName xml.Name `xml:"ListBucketResult" json:"-"` XMLName xml.Name `xml:"ListBucketResult" json:"-"`
Name string Name string

Loading…
Cancel
Save