@@ -695,7 +695,7 @@ func (tf *transformer) transformAsm(args []string) ([]string, error) {
695
695
696
696
// Preprocessor lines to include another file.
697
697
// For example: #include "foo.h"
698
- if quoted := strings .TrimPrefix (line , "#include" ); quoted != line {
698
+ if quoted , ok := strings .CutPrefix (line , "#include" ); ok {
699
699
quoted = strings .TrimSpace (quoted )
700
700
path , err := strconv .Unquote (quoted )
701
701
if err != nil { // note that strconv.Unquote errors do not include the input string
@@ -1185,10 +1185,9 @@ func (tf *transformer) transformLinkname(localName, newName string) (string, str
1185
1185
1186
1186
var newForeignName string
1187
1187
if receiver , name , ok := strings .Cut (foreignName , "." ); ok {
1188
- if strings .HasPrefix (receiver , "(*" ) {
1188
+ if receiver , ok = strings .CutPrefix (receiver , "(*" ); ok {
1189
1189
// pkg/path.(*Receiver).method
1190
- receiver = strings .TrimPrefix (receiver , "(*" )
1191
- receiver = strings .TrimSuffix (receiver , ")" )
1190
+ receiver , _ = strings .CutSuffix (receiver , ")" )
1192
1191
receiver = "(*" + hashWithPackage (lpkg , receiver ) + ")"
1193
1192
} else {
1194
1193
// pkg/path.Receiver.method
@@ -1234,7 +1233,7 @@ func (tf *transformer) processImportCfg(flags []string, requiredPkgs []string) (
1234
1233
}
1235
1234
}
1236
1235
1237
- for _ , line := range strings .Split (string (data ), "\n " ) {
1236
+ for line := range strings .SplitSeq (string (data ), "\n " ) {
1238
1237
if line == "" || strings .HasPrefix (line , "#" ) {
1239
1238
continue
1240
1239
}
@@ -1332,7 +1331,7 @@ func (tf *transformer) processImportCfg(flags []string, requiredPkgs []string) (
1332
1331
// See exporttest/*.go in testdata/scripts/test.txt.
1333
1332
// For now, spot the pattern and avoid the unnecessary error;
1334
1333
// the dependency is unused, so the packagefile line is redundant.
1335
- // This still triggers as of go1.21 .
1334
+ // This still triggers as of go1.24 .
1336
1335
if strings .HasSuffix (tf .curPkg .ImportPath , ".test]" ) && strings .HasPrefix (tf .curPkg .ImportPath , impPath ) {
1337
1336
continue
1338
1337
}
@@ -2257,7 +2256,7 @@ func flagValue(flags []string, name string) string {
2257
2256
// those whose values compose a list.
2258
2257
func flagValueIter (flags []string , name string , fn func (string )) {
2259
2258
for i , arg := range flags {
2260
- if val := strings .TrimPrefix (arg , name + "=" ); val != arg {
2259
+ if val , ok := strings .CutPrefix (arg , name + "=" ); ok {
2261
2260
// -name=value
2262
2261
fn (val )
2263
2262
}
0 commit comments