Fix Secrets Failing Build (#8660)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan 2021-03-24 13:01:58 -05:00 committed by GitHub
parent 9cb4eafad4
commit b2d9f9a2d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 105 deletions

View File

@ -1,6 +1,9 @@
version = 1
exclude_patterns = ["tools/analyzers/**"]
exclude_patterns = [
"tools/analyzers/**",
"validator/keymanager/remote/keymanager_test.go"
]
[[analyzers]]
name = "go"

View File

@ -1,15 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")
load("@prysm//tools/go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["browser.go"],
importpath = "github.com/prysmaticlabs/prysm/shared/browser",
visibility = ["//visibility:public"],
)
go_test(
name = "go_default_test",
srcs = ["browser_test.go"],
embed = [":go_default_library"],
)

View File

@ -1,33 +0,0 @@
/*
// skipcq: SCT-1000
Package from the official Github CLI https://github.com/cli/cli/blob/f30bc5bc64f9c3a839e39713adab48790264119c/pkg/browser/browser.go
All rights reserved to the package authors, respectively. MIT License. See https://github.com/cli/cli/blob/trunk/LICENSE
*/
package browser
import (
"os"
"os/exec"
"strings"
)
// ForOS produces an exec.Cmd to open the web browser for different OS
func ForOS(goos, url string) *exec.Cmd {
exe := "open"
var args []string
switch goos {
case "darwin":
args = append(args, url)
case "windows":
exe = "cmd"
r := strings.NewReplacer("&", "^&")
args = append(args, "/c", "start", r.Replace(url))
default:
exe = "xdg-open"
args = append(args, url)
}
cmd := exec.Command(exe, args...)
cmd.Stderr = os.Stderr
return cmd
}

View File

@ -1,55 +0,0 @@
/*
// skipcq: SCT-1000
Package from the official Github CLI https://github.com/cli/cli/blob/f30bc5bc64f9c3a839e39713adab48790264119c/pkg/browser/browser.go
All rights reserved to the package authors, respectively. MIT License. See https://github.com/cli/cli/blob/trunk/LICENSE
*/
package browser
import (
"reflect"
"testing"
)
func TestForOS(t *testing.T) {
type args struct {
goos string
url string
}
tests := []struct {
name string
args args
want []string
}{
{
name: "macOS",
args: args{
goos: "darwin",
url: "https://example.com/path?a=1&b=2",
},
want: []string{"open", "https://example.com/path?a=1&b=2"},
},
{
name: "Linux",
args: args{
goos: "linux",
url: "https://example.com/path?a=1&b=2",
},
want: []string{"xdg-open", "https://example.com/path?a=1&b=2"},
},
{
name: "Windows",
args: args{
goos: "windows",
url: "https://example.com/path?a=1&b=2&c=3",
},
want: []string{"cmd", "/c", "start", "https://example.com/path?a=1^&b=2^&c=3"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if cmd := ForOS(tt.args.goos, tt.args.url); !reflect.DeepEqual(cmd.Args, tt.want) {
t.Errorf("ForOS() = %v, want %v", cmd.Args, tt.want)
}
})
}
}

View File

@ -15,7 +15,6 @@ go_library(
visibility = ["//validator:__subpackages__"],
deps = [
"//shared:go_default_library",
"//shared/browser:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)