Skip to content

Commit

Permalink
lint: Fix implicit memory aliasing in for loops
Browse files Browse the repository at this point in the history
Fix all instances of gosec G601: Implicit memory aliasing in for loop.
  • Loading branch information
bcl authored and achilleas-k committed Sep 21, 2023
1 parent 1b65f15 commit 9e39080
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/osbuild-pipeline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ func main() {
if repo.GPGKey != "" {
keys = []string{repo.GPGKey}
}

checkGPG := repo.CheckGPG
repos[i] = rpmmd.RepoConfig{
Id: repoId,
Name: repoName,
BaseURLs: urls,
Metalink: repo.Metalink,
MirrorList: repo.MirrorList,
GPGKeys: keys,
CheckGPG: &repo.CheckGPG,
CheckGPG: &checkGPG,
CheckRepoGPG: common.ToPtr(false),
IgnoreSSL: common.ToPtr(false),
PackageSets: repo.PackageSets,
Expand Down
7 changes: 4 additions & 3 deletions internal/blueprint/customizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,11 @@ func (c *Customizations) GetUsers() []UserCustomization {

// prepend sshkey for backwards compat (overridden by users)
if len(c.SSHKey) > 0 {
for _, c := range c.SSHKey {
for _, k := range c.SSHKey {
key := k.Key
users = append(users, UserCustomization{
Name: c.User,
Key: &c.Key,
Name: k.User,
Key: &key,
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion internal/cloudapi/v2/v2_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ func TestRepoConfigConversion(t *testing.T) {
}

for idx, tc := range testCases {
repoConfig := tc.repoConfig
rc, err := genRepoConfig(tc.repo)
assert.NoError(err)
assert.Equal(&tc.repoConfig, rc, "mismatch in test case %d", idx)
assert.Equal(&repoConfig, rc, "mismatch in test case %d", idx)
}

errorTestCases := []struct {
Expand Down

0 comments on commit 9e39080

Please sign in to comment.