Skip to content

Commit a57639a

Browse files
cuiweixiegopherbot
authored andcommitted
cmd/cgo: use strings.TrimSuffix
Change-Id: I97b5592c678c350fd77069d7c40a98864733707a Reviewed-on: https://go-review.googlesource.com/c/go/+/435946 Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cherry Mui <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]>
1 parent ea2a2c0 commit a57639a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/cmd/cgo/out.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,7 @@ func (p *Package) writeDefsFunc(fgo2 io.Writer, n *Name, callsMalloc *bool) {
627627
// writeOutput creates stubs for a specific source file to be compiled by gc
628628
func (p *Package) writeOutput(f *File, srcfile string) {
629629
base := srcfile
630-
if strings.HasSuffix(base, ".go") {
631-
base = base[0 : len(base)-3]
632-
}
630+
base = strings.TrimSuffix(base, ".go")
633631
base = filepath.Base(base)
634632
fgo1 := creat(*objDir + base + ".cgo1.go")
635633
fgcc := creat(*objDir + base + ".cgo2.c")

0 commit comments

Comments
 (0)