From 2e34cfcb95cb3d24b197d58fe6d25046b8f25c86 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 25 Jul 2019 00:40:27 +0000 Subject: [PATCH] internal/import: strings.Trim expects a cutset, not a string strings.Trim treats the second parameter as a set of characters you want to trim. It does not look for an entire string to trim. This fix will maintain the current behavior, simply eliminating the dupe character in the set. Should we instead mean to really trim the entire string, this needs a different fix. Change-Id: Id3fa4105421819edc6a898efb1ffab26c8cea67a GitHub-Last-Rev: 198e429869711ee1510fffe5a993acb07eff4502 GitHub-Pull-Request: golang/tools#142 Reviewed-on: https://go-review.googlesource.com/c/tools/+/187497 Reviewed-by: Ian Cottrell Reviewed-by: Heschi Kreinick Run-TryBot: Ian Cottrell --- internal/imports/fix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/imports/fix.go b/internal/imports/fix.go index 72323f58..615dc014 100644 --- a/internal/imports/fix.go +++ b/internal/imports/fix.go @@ -444,7 +444,7 @@ func apply(fset *token.FileSet, f *ast.File, fixes []*importFix) bool { case setImportName: // Find the matching import path and change the name. for _, spec := range f.Imports { - path := strings.Trim(spec.Path.Value, `""`) + path := strings.Trim(spec.Path.Value, `"`) if path == fix.info.importPath { spec.Name = &ast.Ident{ Name: fix.info.name,