Skip to content

strings: TrimRight() is not entirely right #46885

@av86743

Description

@av86743

What version of Go are you using (go version)?

Playground go1.16.5

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

Playground whatever.

What did you do?

Playground link

package main

import (
	"fmt"
	"strings"
	"runtime"
)

func main() {
	println(runtime.Version())

	ss := []string{ `Core.go`, `DebugInfo.go`, `Verifier.go` }
	sfx := `.go`
for _, s := range ss {
	s_ := strings.TrimRight(s, sfx)
	fmt.Println(s_)
}
}

What did you expect to see?

go1.16.5
Core
DebugInfo
Verifier

What did you see instead?

go1.16.5
Core
DebugInf
Verifier

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions