Skip to content

false positive of g602 with maps #1005

Closed
@david-gang

Description

Summary

When setting keys in maps which obviously fon't exist before we get an error message

Steps to reproduce the behavior

filter := make(map[string]any, 0)
		filter["term"] = map[string]interface{}{
			filedName: map[string]interface{}{
				"value": 5,
			},
		}
		res = append(res, filter)
	}

gosec version

v2.17.0

Go version (output of 'go version')

GitHub Actions / golangci
golangci-lint-1.54.2, go 1.19

Operating system / Environment

ubuntu/ gh actions

Expected behavior

no error

Actual behavior

gives error

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions