golang/go

cmd/go: misleading `fatal:` log message when working in a git repo with no commits

Open

#52 263 ouverte le 10 avr. 2022

Voir sur GitHub
 (4 commentaires) (2 réactions) (0 assignés)Go (19 008 forks)batch import
GoCommandNeedsInvestigationhelp wanted

Métriques du dépôt

Stars
 (133 883 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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

Does this issue reproduce with the latest release?

Yes

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

What did you do?

$ cd /tmp                                                                                                                                                                     [19/19]
$ git init x
Initialized empty Git repository in /tmp/x/.git/
$ cd x
$ go mod init x
go: creating new go.mod: module x
$ cat > main.go
// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
        fmt.Println("Hello, 世界")
}
$ go build -v
# cd /tmp/x; git -c log.showsignature=false show -s --format=%H:%ct
fatal: your current branch 'master' does not have any commits yet
$

What did you expect to see?

A successful build.

What did you see instead?

Build itself failed.

Edit: The build does succeed even though the "fatal" message is printed.

Guide contributeur