builder: prefer GNU build ID over Go build ID
The GNU build ID covers the Go build ID, and probably some more.
Этот коммит содержится в:
родитель
4210200070
коммит
a7a69d38a4
1 изменённых файлов: 11 добавлений и 1 удалений
|
@ -30,6 +30,7 @@ func ReadBuildID() ([]byte, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
var gnuID, goID []byte
|
||||||
for _, section := range file.Sections {
|
for _, section := range file.Sections {
|
||||||
if section.Type != elf.SHT_NOTE ||
|
if section.Type != elf.SHT_NOTE ||
|
||||||
(section.Name != ".note.gnu.build-id" && section.Name != ".note.go.buildid") {
|
(section.Name != ".note.gnu.build-id" && section.Name != ".note.go.buildid") {
|
||||||
|
@ -40,7 +41,16 @@ func ReadBuildID() ([]byte, error) {
|
||||||
if uint64(n) != section.Size || err != nil {
|
if uint64(n) != section.Size || err != nil {
|
||||||
return nil, fmt.Errorf("could not read build id: %w", err)
|
return nil, fmt.Errorf("could not read build id: %w", err)
|
||||||
}
|
}
|
||||||
return buf, nil
|
if section.Name == ".note.gnu.build-id" {
|
||||||
|
gnuID = buf
|
||||||
|
} else {
|
||||||
|
goID = buf
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if gnuID != nil {
|
||||||
|
return gnuID, nil
|
||||||
|
} else if goID != nil {
|
||||||
|
return goID, nil
|
||||||
}
|
}
|
||||||
case "darwin":
|
case "darwin":
|
||||||
// Read the LC_UUID load command, which contains the equivalent of a
|
// Read the LC_UUID load command, which contains the equivalent of a
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче