summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/tools/internal/imports
diff options
context:
space:
mode:
authorLibravatar Daenney <git@noreply.sourcery.dny.nu>2025-07-18 11:56:40 +0200
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-07-18 11:56:40 +0200
commiteb600819854039c8d89fb1d7000f301ad3c7d542 (patch)
tree267138dcdf3280e32ef4dde7b5a3355212bd0474 /vendor/golang.org/x/tools/internal/imports
parent[feature] Add `avif` file support (#4331) (diff)
downloadgotosocial-eb600819854039c8d89fb1d7000f301ad3c7d542.tar.xz
[chore/deps] Upgrade to go-sqlite 0.27.1 (#4334)
# Description This brings some performance improvements and SQLite 3.50.3. ## Checklist Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]` If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want). - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have not leveraged AI to create the proposed changes. - [ ] I/we have performed a self-review of added code. - [ ] I/we have written code that is legible and maintainable by others. - [ ] I/we have commented the added code, particularly in hard-to-understand areas. - [ ] I/we have made any necessary changes to documentation. - [ ] I/we have added tests that cover new code. - [x] I/we have run tests and they pass locally with the changes. - [ ] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4334 Co-authored-by: Daenney <git@noreply.sourcery.dny.nu> Co-committed-by: Daenney <git@noreply.sourcery.dny.nu>
Diffstat (limited to 'vendor/golang.org/x/tools/internal/imports')
-rw-r--r--vendor/golang.org/x/tools/internal/imports/fix.go9
-rw-r--r--vendor/golang.org/x/tools/internal/imports/imports.go2
2 files changed, 6 insertions, 5 deletions
diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go
index 89b96381c..50b6ca51a 100644
--- a/vendor/golang.org/x/tools/internal/imports/fix.go
+++ b/vendor/golang.org/x/tools/internal/imports/fix.go
@@ -27,12 +27,13 @@ import (
"unicode"
"unicode/utf8"
+ "maps"
+
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/gopathwalk"
"golang.org/x/tools/internal/stdlib"
- "maps"
)
// importToGroup is a list of functions which map from an import path to
@@ -290,8 +291,8 @@ func (p *pass) loadPackageNames(ctx context.Context, imports []*ImportInfo) erro
return nil
}
-// if there is a trailing major version, remove it
-func withoutVersion(nm string) string {
+// WithoutVersion removes a trailing major version, if there is one.
+func WithoutVersion(nm string) string {
if v := path.Base(nm); len(v) > 0 && v[0] == 'v' {
if _, err := strconv.Atoi(v[1:]); err == nil {
// this is, for instance, called with rand/v2 and returns rand
@@ -313,7 +314,7 @@ func (p *pass) importIdentifier(imp *ImportInfo) string {
}
known := p.knownPackages[imp.ImportPath]
if known != nil && known.Name != "" {
- return withoutVersion(known.Name)
+ return WithoutVersion(known.Name)
}
return ImportPathToAssumedName(imp.ImportPath)
}
diff --git a/vendor/golang.org/x/tools/internal/imports/imports.go b/vendor/golang.org/x/tools/internal/imports/imports.go
index 2215a1288..b5f5218b5 100644
--- a/vendor/golang.org/x/tools/internal/imports/imports.go
+++ b/vendor/golang.org/x/tools/internal/imports/imports.go
@@ -93,7 +93,7 @@ func FixImports(ctx context.Context, filename string, src []byte, goroot string,
// env is needed.
func ApplyFixes(fixes []*ImportFix, filename string, src []byte, opt *Options, extraMode parser.Mode) (formatted []byte, err error) {
// Don't use parse() -- we don't care about fragments or statement lists
- // here, and we need to work with unparseable files.
+ // here, and we need to work with unparsable files.
fileSet := token.NewFileSet()
parserMode := parser.SkipObjectResolution
if opt.Comments {