Skip to content

strings.TrimLeft("xxx "), In case of loss of a #62344

Closed as not planned
Closed as not planned
@icowan

Description

@icowan
        var authorization = "Bearer app-xxx"
	fmt.Println(strings.TrimLeft(authorization, "Bearer "))
	fmt.Println(strings.TrimLeft(authorization, "Bearer"))
	fmt.Println(strings.TrimSpace(strings.TrimLeft(authorization, "Bearer")))
	fmt.Println("-------")
	authorization = "Bearer sk-xxx"
	fmt.Println(strings.TrimLeft(authorization, "Bearer "))
	fmt.Println(strings.TrimLeft(authorization, "Bearer"))
	fmt.Println(strings.TrimSpace(strings.TrimLeft(authorization, "Bearer")))
image

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

go version go1.20.1 darwin/amd64

Does this issue reproduce with the latest release?

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

go env Output
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/dudulu/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/go"
GOPRIVATE=""
GOPROXY=""
GOROOT="/go/go1.20.1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/go/go1.20.1/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="0"
GOMOD="go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qd/h_6jw84502g0r1q7b61w3wsc0000gn/T/go-build257210823=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

nothing

What did you expect to see?

// pp-

What did you see instead?

// app-

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