Skip to content
This repository has been archived by the owner on Mar 2, 2020. It is now read-only.

Commit

Permalink
Omit explicit bool check
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrachev authored and kardianos committed Nov 14, 2018
1 parent cfb1f6e commit f544984
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions context/context.go
Expand Up @@ -333,7 +333,7 @@ func (ctx *Context) findPackageChild(ck *Package) []*Package {
if pkg == ck {
continue
}
if pkg.inVendor == false {
if !pkg.inVendor {
continue
}
if pkg.Status.Presence == PresenceTree {
Expand All @@ -351,10 +351,10 @@ func (ctx *Context) findPackageChild(ck *Package) []*Package {
func (ctx *Context) findPackageParentTree(ck *Package) []string {
out := make([]string, 0, 1)
for _, pkg := range ctx.Package {
if pkg.inVendor == false {
if !pkg.inVendor {
continue
}
if pkg.IncludeTree == false || pkg == ck {
if !pkg.IncludeTree || pkg == ck {
continue
}
// pkg.Path = github.com/usera/pkg, tree = true
Expand Down
2 changes: 1 addition & 1 deletion context/context_test.go
Expand Up @@ -1065,7 +1065,7 @@ func TestRemove(t *testing.T) {
if err != nil {
t.Fatal("vendor folder should still be present", err)
}
if vi.IsDir() == false {
if !vi.IsDir() {
t.Fatal("vendor folder is not a dir")
}
}
Expand Down
4 changes: 2 additions & 2 deletions context/label.go
Expand Up @@ -74,7 +74,7 @@ func (item *labelAnalysis) fillSections(buf *bytes.Buffer) {
if err != nil {
value = -1
}
if isBreak(r) == false {
if !isBreak(r) {
r = 0
}
group.sections = append(group.sections, labelSection{
Expand Down Expand Up @@ -209,7 +209,7 @@ func FindLabel(version string, labels []Label) Label {
}
continue
}
if strings.HasPrefix(label.Text, version) == false {
if !strings.HasPrefix(label.Text, version) {
continue
}
remain := strings.TrimPrefix(label.Text, version)
Expand Down
4 changes: 2 additions & 2 deletions context/modify.go
Expand Up @@ -470,7 +470,7 @@ func (ctx *Context) modifyRemove(pkg *Package) error {
return nil
}
// Protect non-project paths from being removed.
if pathos.FileHasPrefix(pkg.Dir, ctx.RootDir) == false {
if !pathos.FileHasPrefix(pkg.Dir, ctx.RootDir) {
return nil
}
if pkg.Status.Location == LocationLocal {
Expand Down Expand Up @@ -569,7 +569,7 @@ func (ctx *Context) Check() []*Conflict {
// Operation listed in the OpIndex field.
func (ctx *Context) ResloveApply(cc []*Conflict) {
for _, c := range cc {
if c.Resolved == false {
if !c.Resolved {
continue
}
for i, op := range c.Operation {
Expand Down
12 changes: 6 additions & 6 deletions context/path.go
Expand Up @@ -24,7 +24,7 @@ func (ctx *Context) isStdLib(importPath string) (yes bool, err error) {
if fi == nil {
return
}
if fi.IsDir() == false {
if !fi.IsDir() {
return
}

Expand Down Expand Up @@ -54,7 +54,7 @@ func (ctx *Context) findImportDir(relative, importPath string) (dir, gopath stri
if err != nil {
continue
}
if fi.IsDir() == false {
if !fi.IsDir() {
continue
}
for _, gopath = range ctx.GopathList {
Expand All @@ -80,7 +80,7 @@ func (ctx *Context) findImportDir(relative, importPath string) (dir, gopath stri
if fi == nil {
continue
}
if fi.IsDir() == false {
if !fi.IsDir() {
continue
}

Expand Down Expand Up @@ -117,7 +117,7 @@ func findRoot(folder, vendorPath string) (root string, err error) {
for i := 0; i <= looplimit; i++ {
test := filepath.Join(folder, vendorPath)
_, err := os.Stat(test)
if os.IsNotExist(err) == false {
if !os.IsNotExist(err) {
return folder, nil
}
nextFolder := filepath.Clean(filepath.Join(folder, ".."))
Expand Down Expand Up @@ -146,7 +146,7 @@ func hasGoFileInFolder(folder string) (bool, error) {
return false, err
}
for _, fi := range fl {
if fi.IsDir() == false && filepath.Ext(fi.Name()) == ".go" {
if !fi.IsDir() && filepath.Ext(fi.Name()) == ".go" {
return true, nil
}
}
Expand Down Expand Up @@ -210,7 +210,7 @@ func RemovePackage(path, root string, tree bool) error {
if len(fl) > 0 {
allAreLicense := true
for _, fi := range fl {
if isLicenseFile(fi.Name()) == false {
if !isLicenseFile(fi.Name()) {
allAreLicense = false
break
}
Expand Down
6 changes: 3 additions & 3 deletions context/resolve.go
Expand Up @@ -80,7 +80,7 @@ func (ctx *Context) loadPackage() error {
func (ctx *Context) getFileTags(pathname string, f *ast.File) (tags *TagSet, imports []string, err error) {
_, filenameExt := filepath.Split(pathname)

if strings.HasSuffix(pathname, ".go") == false {
if !strings.HasSuffix(pathname, ".go") {
return nil, nil, nil
}
if f == nil {
Expand Down Expand Up @@ -151,12 +151,12 @@ func (ctx *Context) addFileImports(pathname, gopath string) (*Package, error) {
importPath = pathos.SlashToImportPath(importPath)
importPath = strings.Trim(importPath, "/")

if strings.HasSuffix(pathname, ".go") == false {
if !strings.HasSuffix(pathname, ".go") {
return nil, nil
}
// No need to add the same file more than once.
for _, pkg := range ctx.Package {
if pathos.FileStringEquals(pkg.Dir, dir) == false {
if !pathos.FileStringEquals(pkg.Dir, dir) {
continue
}
for _, f := range pkg.Files {
Expand Down
4 changes: 2 additions & 2 deletions context/rewrite.go
Expand Up @@ -101,13 +101,13 @@ func (ctx *Context) rewrite() error {
Tabwidth: 8,
}
for _, fileInfo := range filePaths {
if pathos.FileHasPrefix(fileInfo.Path, ctx.RootDir) == false {
if !pathos.FileHasPrefix(fileInfo.Path, ctx.RootDir) {
continue
}

// Read the file into AST, modify the AST.
fileset := token.NewFileSet()
f, err := parser.ParseFile(fileset, fileInfo.Path, nil, parser.ParseComments)
f, _ := parser.ParseFile(fileset, fileInfo.Path, nil, parser.ParseComments)
if f == nil {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion context/version.go
Expand Up @@ -29,7 +29,7 @@ func isVersion(s string) bool {
if hasPunct {
return true
}
if onlyHexLetter == false {
if !onlyHexLetter {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion migrate/godep.go
Expand Up @@ -93,7 +93,7 @@ func (sysGodep) Migrate(root string) error {

for _, d := range godeps.Deps {
for _, pkg := range ctx.Package {
if strings.HasPrefix(pkg.Path, d.ImportPath) == false {
if !strings.HasPrefix(pkg.Path, d.ImportPath) {
continue
}
vf := ctx.VendorFilePackagePath(pkg.Path)
Expand Down
4 changes: 2 additions & 2 deletions migrate/migrate.go
Expand Up @@ -112,7 +112,7 @@ func hasDirs(root string, dd ...string) bool {
if err != nil {
return false
}
if fi.IsDir() == false {
if !fi.IsDir() {
return false
}
}
Expand All @@ -125,7 +125,7 @@ func hasFiles(root string, dd ...string) bool {
if err != nil {
return false
}
if fi.IsDir() == true {
if fi.IsDir() {
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion run/filter.go
Expand Up @@ -164,7 +164,7 @@ func insertListToAllNot(sg *context.StatusGroup, list []context.Status) {
if len(sg.Group) == 0 {
allStatusNot := true
for _, s := range sg.Status {
if s.Not == false {
if !s.Not {
allStatusNot = false
break
}
Expand Down
2 changes: 1 addition & 1 deletion run/license.go
Expand Up @@ -87,7 +87,7 @@ func (r *runner) License(w io.Writer, subCmdArgs []string) (help.HelpMessage, er
}

for _, item := range list {
if f.HasStatus(item) == false {
if !f.HasStatus(item) {
continue
}
if len(f.Import) != 0 && f.FindImport(item) == nil {
Expand Down
2 changes: 1 addition & 1 deletion run/list.go
Expand Up @@ -99,7 +99,7 @@ func (r *runner) List(w io.Writer, subCmdArgs []string) (help.HelpMessage, error
tw := tabwriter.NewWriter(w, 0, 4, 2, ' ', 0)
defer tw.Flush()
for _, item := range list {
if f.HasStatus(item) == false {
if !f.HasStatus(item) {
continue
}
if len(f.Import) != 0 && f.FindImport(item) == nil {
Expand Down
2 changes: 1 addition & 1 deletion vcs/bzr.go
Expand Up @@ -23,7 +23,7 @@ func (VcsBzr) Find(dir string) (*VcsInfo, error) {
}
return nil, err
}
if fi.IsDir() == false {
if !fi.IsDir() {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion vcs/git.go
Expand Up @@ -23,7 +23,7 @@ func (VcsGit) Find(dir string) (*VcsInfo, error) {
}
return nil, err
}
if fi.IsDir() == false {
if !fi.IsDir() {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion vcs/hg.go
Expand Up @@ -23,7 +23,7 @@ func (VcsHg) Find(dir string) (*VcsInfo, error) {
}
return nil, err
}
if fi.IsDir() == false {
if !fi.IsDir() {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion vcs/svn.go
Expand Up @@ -23,7 +23,7 @@ func (svn VcsSvn) Find(dir string) (*VcsInfo, error) {
}
return nil, err
}
if fi.IsDir() == false {
if !fi.IsDir() {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion vcs/vcs.go
Expand Up @@ -70,7 +70,7 @@ func FindVcs(root, packageDir string) (info *VcsInfo, err error) {
if nextPath == path {
return nil, nil
}
if pathos.FileHasPrefix(nextPath, root) == false {
if !pathos.FileHasPrefix(nextPath, root) {
return nil, nil
}
path = nextPath
Expand Down
4 changes: 2 additions & 2 deletions vendorfile/file.go
Expand Up @@ -139,7 +139,7 @@ loop:
continue loop
}
*field = value
if value == true {
if value {
break loop
}
}
Expand All @@ -160,7 +160,7 @@ func setObject(fieldObj interface{}, object map[string]interface{}, names []stri
}
case bool:
for i, name := range names {
if i != 0 || (hideEmpty && field == false) {
if i != 0 || (hideEmpty && !field) {
delete(object, name)
continue
}
Expand Down

0 comments on commit f544984

Please sign in to comment.