GitHubTUFOptions no longer needs to return error
Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
parent
2ef8eb6a1f
commit
b5f6bd5cfa
4 changed files with 5 additions and 12 deletions
|
|
@ -68,10 +68,7 @@ func tufRootVerify(mirror, root string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to read root file %s: %w", root, err)
|
||||
}
|
||||
opts, err := verification.GitHubTUFOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
opts := verification.GitHubTUFOptions()
|
||||
opts.Root = rb
|
||||
opts.RepositoryBaseURL = mirror
|
||||
// The purpose is the verify the TUF root and repository, make
|
||||
|
|
|
|||
|
|
@ -172,10 +172,7 @@ func newCustomVerifier(trustedRootFilePath string) (*verify.SignedEntityVerifier
|
|||
}
|
||||
|
||||
func newGitHubVerifier() (*verify.SignedEntityVerifier, error) {
|
||||
opts, err := GitHubTUFOptions()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opts := GitHubTUFOptions()
|
||||
client, err := tuf.New(opts)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create TUF client: %w", err)
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ func DefaultOptionsWithCacheSetting() *tuf.Options {
|
|||
return opts
|
||||
}
|
||||
|
||||
func GitHubTUFOptions() (*tuf.Options, error) {
|
||||
func GitHubTUFOptions() *tuf.Options {
|
||||
opts := DefaultOptionsWithCacheSetting()
|
||||
|
||||
opts.Root = githubRoot
|
||||
opts.RepositoryBaseURL = GitHubTUFMirror
|
||||
|
||||
return opts, nil
|
||||
return opts
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ import (
|
|||
|
||||
func TestGitHubTUFOptions(t *testing.T) {
|
||||
os.Setenv("CODESPACES", "true")
|
||||
opts, err := GitHubTUFOptions()
|
||||
require.NoError(t, err)
|
||||
opts := GitHubTUFOptions()
|
||||
|
||||
require.Equal(t, GitHubTUFMirror, opts.RepositoryBaseURL)
|
||||
require.NotNil(t, opts.Root)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue