Assertion fix in config key generation (#6902)

This commit is contained in:
Vivek Lakshmanan 2021-08-02 12:22:09 -07:00 committed by GitHub
parent ec5bafc3e2
commit 3b009c1266
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -32,6 +32,7 @@ func TestPrettyKeyForProject(t *testing.T) {
assert.Equal(t, "foo", prettyKeyForProject(config.MustMakeKey("test-package", "foo"), proj))
assert.Equal(t, "other-package:bar", prettyKeyForProject(config.MustMakeKey("other-package", "bar"), proj))
assert.Panics(t, func() { config.MustMakeKey("other:package", "bar") })
}
func TestSecretDetection(t *testing.T) {

View file

@ -31,7 +31,7 @@ type Key struct {
// MustMakeKey constructs a config.Key for a given namespace and name. The namespace may not contain a `:`
func MustMakeKey(namespace string, name string) Key {
contract.Requiref(!strings.Contains(":", namespace), "namespace", "may not contain a colon")
contract.Requiref(!strings.Contains(namespace, ":"), "namespace", "may not contain a colon")
return Key{namespace: namespace, name: name}
}