-
-
Notifications
You must be signed in to change notification settings - Fork 408
staticcheck: detect uses of fmt.Sprintf for URL-like values #730
Copy link
Copy link
Open
Labels
aggressiveA set of checks that is more prone to false positives but is helpful during code reviewA set of checks that is more prone to false positives but is helpful during code reviewneeds-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenew-check
Milestone
Metadata
Metadata
Assignees
Labels
aggressiveA set of checks that is more prone to false positives but is helpful during code reviewA set of checks that is more prone to false positives but is helpful during code reviewneeds-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenew-check
Not sure about the universality on this one, but filing just in case. Also not sure if it's more of a staticcheck or a stylecheck.
This is probably not the best way to create a URL. While the host part may be considered “acceptable”, the query part just looks like bad code to me. Best case scenario: this leads to occasional errors because of bad URLs. Worst case scenario: data leakage due to undervalidated parameters.
I think that this would be much better with
*url.URL,url.Values, andpath.Join.