-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Go version
go version go1.23.3 linux/arm64
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2955114020=/tmp/go-build -gno-record-gcc-switches'What did you do?
Ran go mod tidy with a go.mod that contained a stray empty line in a require block
Reproduction steps
Create a minimal module with at least one dependency
mkdir tidy && cd tidy
cat > main.go <<'EOF'
package main
import (
"fmt"
"golang.org/x/time/rate"
)
var Foo = rate.Limit
func main() {
fmt.Println("hello")
}
EOFCreate a go.mod with trailing empty lines in the require section;
cat > go.mod <<'EOF'
module tidy
go 1.23.0
require (
"golang.org/x/time" v0.8.0
)
EOFRun go mod tidy;
go mod tidyCheck the content of go.mod, and observe that an empty line is left behind in the require section;
cat go.mod
module tidy
go 1.23.0
require (
golang.org/x/time v0.8.0
)What did you see happen?
The empty line was kept even after running go mod tidy
What did you expect to see?
The empty line to be removed.
dmitshur
Metadata
Metadata
Assignees
Labels
GoCommandcmd/gocmd/goNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.