Loading tools/compliance/cmd/checkshare/checkshare_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -259,7 +259,7 @@ func Test(t *testing.T) { if len(ts) < 1 { continue } if 0 < len(actualStdout) { if len(actualStdout) > 0 { t.Errorf("checkshare: unexpected multiple output lines %q, want %q", actualStdout+"\n"+ts, tt.expectedStdout) } actualStdout = ts Loading tools/compliance/cmd/htmlnotice/htmlnotice.go +4 −4 Original line number Diff line number Diff line Loading @@ -204,17 +204,17 @@ func htmlNotice(ctx *context, files ...string) error { fmt.Fprintln(ctx.stdout, "li { padding-left: 1em; }") fmt.Fprintln(ctx.stdout, ".file-list { margin-left: 1em; }") fmt.Fprintln(ctx.stdout, "</style>") if 0 < len(ctx.title) { if len(ctx.title) > 0 { fmt.Fprintf(ctx.stdout, "<title>%s</title>\n", html.EscapeString(ctx.title)) } else if 0 < len(ctx.product) { } else if len(ctx.product) > 0 { fmt.Fprintf(ctx.stdout, "<title>%s</title>\n", html.EscapeString(ctx.product)) } fmt.Fprintln(ctx.stdout, "</head>") fmt.Fprintln(ctx.stdout, "<body>") if 0 < len(ctx.title) { if len(ctx.title) > 0 { fmt.Fprintf(ctx.stdout, " <h1>%s</h1>\n", html.EscapeString(ctx.title)) } else if 0 < len(ctx.product) { } else if len(ctx.product) > 0 { fmt.Fprintf(ctx.stdout, " <h1>%s</h1>\n", html.EscapeString(ctx.product)) } ids := make(map[string]string) Loading tools/compliance/cmd/htmlnotice/htmlnotice_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -678,7 +678,7 @@ func Test(t *testing.T) { } if !inBody { if expectTitle { if tl := checkTitle(line); 0 < len(tl) { if tl := checkTitle(line); len(tl) > 0 { if tl != ttle.t { t.Errorf("htmlnotice: unexpected title: got %q, want %q", tl, ttle.t) } Loading tools/compliance/cmd/textnotice/textnotice.go +1 −1 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ func textNotice(ctx *context, files ...string) error { return fmt.Errorf("Unable to read license text file(s) for %q: %v\n", files, err) } if 0 < len(ctx.title) { if len(ctx.title) > 0 { fmt.Fprintf(ctx.stdout, "%s\n\n", ctx.title) } for h := range ni.Hashes() { Loading tools/compliance/noticeindex.go +5 −5 Original line number Diff line number Diff line Loading @@ -337,14 +337,14 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode) string { } // remove LICENSE or NOTICE or other filename li := strings.LastIndex(match, "/") if 0 < li { if li > 0 { match = match[:li] } // remove *licenses/ path segment and subdirectory if in path if offsets := licensesPathRegexp.FindAllStringIndex(match, -1); offsets != nil && 0 < offsets[len(offsets)-1][0] { if offsets := licensesPathRegexp.FindAllStringIndex(match, -1); offsets != nil && offsets[len(offsets)-1][0] > 0 { match = match[:offsets[len(offsets)-1][0]] li = strings.LastIndex(match, "/") if 0 < li { if li > 0 { match = match[:li] } } Loading @@ -366,7 +366,7 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode) string { // strip off [./]meta_lic from license metadata path and extract base name n := noticeFor.name[:len(noticeFor.name)-9] li := strings.LastIndex(n, "/") if 0 < li { if li > 0 { n = n[li+1:] } return n Loading Loading @@ -580,7 +580,7 @@ func (l hashList) Swap(i, j int) { (*l.hashes)[i], (*l.hashes)[j] = (*l.hashes)[ // the `j`th element. func (l hashList) Less(i, j int) bool { var insti, instj int if 0 < len(l.libName) { if len(l.libName) > 0 { insti = len(l.ni.hashLibInstall[(*l.hashes)[i]][l.libName]) instj = len(l.ni.hashLibInstall[(*l.hashes)[j]][l.libName]) } else { Loading Loading
tools/compliance/cmd/checkshare/checkshare_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -259,7 +259,7 @@ func Test(t *testing.T) { if len(ts) < 1 { continue } if 0 < len(actualStdout) { if len(actualStdout) > 0 { t.Errorf("checkshare: unexpected multiple output lines %q, want %q", actualStdout+"\n"+ts, tt.expectedStdout) } actualStdout = ts Loading
tools/compliance/cmd/htmlnotice/htmlnotice.go +4 −4 Original line number Diff line number Diff line Loading @@ -204,17 +204,17 @@ func htmlNotice(ctx *context, files ...string) error { fmt.Fprintln(ctx.stdout, "li { padding-left: 1em; }") fmt.Fprintln(ctx.stdout, ".file-list { margin-left: 1em; }") fmt.Fprintln(ctx.stdout, "</style>") if 0 < len(ctx.title) { if len(ctx.title) > 0 { fmt.Fprintf(ctx.stdout, "<title>%s</title>\n", html.EscapeString(ctx.title)) } else if 0 < len(ctx.product) { } else if len(ctx.product) > 0 { fmt.Fprintf(ctx.stdout, "<title>%s</title>\n", html.EscapeString(ctx.product)) } fmt.Fprintln(ctx.stdout, "</head>") fmt.Fprintln(ctx.stdout, "<body>") if 0 < len(ctx.title) { if len(ctx.title) > 0 { fmt.Fprintf(ctx.stdout, " <h1>%s</h1>\n", html.EscapeString(ctx.title)) } else if 0 < len(ctx.product) { } else if len(ctx.product) > 0 { fmt.Fprintf(ctx.stdout, " <h1>%s</h1>\n", html.EscapeString(ctx.product)) } ids := make(map[string]string) Loading
tools/compliance/cmd/htmlnotice/htmlnotice_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -678,7 +678,7 @@ func Test(t *testing.T) { } if !inBody { if expectTitle { if tl := checkTitle(line); 0 < len(tl) { if tl := checkTitle(line); len(tl) > 0 { if tl != ttle.t { t.Errorf("htmlnotice: unexpected title: got %q, want %q", tl, ttle.t) } Loading
tools/compliance/cmd/textnotice/textnotice.go +1 −1 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ func textNotice(ctx *context, files ...string) error { return fmt.Errorf("Unable to read license text file(s) for %q: %v\n", files, err) } if 0 < len(ctx.title) { if len(ctx.title) > 0 { fmt.Fprintf(ctx.stdout, "%s\n\n", ctx.title) } for h := range ni.Hashes() { Loading
tools/compliance/noticeindex.go +5 −5 Original line number Diff line number Diff line Loading @@ -337,14 +337,14 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode) string { } // remove LICENSE or NOTICE or other filename li := strings.LastIndex(match, "/") if 0 < li { if li > 0 { match = match[:li] } // remove *licenses/ path segment and subdirectory if in path if offsets := licensesPathRegexp.FindAllStringIndex(match, -1); offsets != nil && 0 < offsets[len(offsets)-1][0] { if offsets := licensesPathRegexp.FindAllStringIndex(match, -1); offsets != nil && offsets[len(offsets)-1][0] > 0 { match = match[:offsets[len(offsets)-1][0]] li = strings.LastIndex(match, "/") if 0 < li { if li > 0 { match = match[:li] } } Loading @@ -366,7 +366,7 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode) string { // strip off [./]meta_lic from license metadata path and extract base name n := noticeFor.name[:len(noticeFor.name)-9] li := strings.LastIndex(n, "/") if 0 < li { if li > 0 { n = n[li+1:] } return n Loading Loading @@ -580,7 +580,7 @@ func (l hashList) Swap(i, j int) { (*l.hashes)[i], (*l.hashes)[j] = (*l.hashes)[ // the `j`th element. func (l hashList) Less(i, j int) bool { var insti, instj int if 0 < len(l.libName) { if len(l.libName) > 0 { insti = len(l.ni.hashLibInstall[(*l.hashes)[i]][l.libName]) instj = len(l.ni.hashLibInstall[(*l.hashes)[j]][l.libName]) } else { Loading