403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/go/src/cmd/go/testdata/script/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/go/src/cmd/go/testdata/script/build_pgo.txt
# Test go build -pgo flag.
# Specifically, the build cache handles profile content correctly.

[short] skip 'compiles and links executables'

# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE

# build without PGO
go build triv.go

# build with PGO, should trigger rebuild
# starting with an empty profile (the compiler accepts it)
go build -x -pgo=prof -o triv.exe triv.go
stderr 'preprofile.*-i.*prof'
stderr 'compile.*-pgoprofile=.*triv.go'

# check that PGO appears in build info
# N.B. we can't start the stdout check with -pgo because the script assumes that
# if the first arg starts with - it is a grep flag.
go version -m triv.exe
stdout 'build\s+-pgo=.*'${/}'prof'

# store the build ID
go list -export -json=BuildID -pgo=prof triv.go
stdout '"BuildID":' # check that output actually contains a build ID
cp stdout list.out

# build again with the same profile, should be cached
go build -x -pgo=prof -o triv.exe triv.go
! stderr 'compile.*triv.go'

# check that the build ID is the same
go list -export -json=BuildID -pgo=prof triv.go
cmp stdout list.out

# overwrite the prof
go run overwrite.go

# build again, profile content changed, should trigger rebuild, including std
go build -n -pgo=prof triv.go
stderr 'preprofile.*-i.*prof'
stderr 'compile.*-pgoprofile=.*triv.go'
stderr 'compile.*-p runtime.*-pgoprofile=.*'

# check that the build ID is different
go list -export -json=BuildID -pgo=prof triv.go
! cmp stdout list.out

# build with trimpath, buildinfo path should be trimmed
go build -x -pgo=prof -trimpath -o triv.exe triv.go

# check that path is trimmed
go version -m triv.exe
stdout 'build\s+-pgo=prof'

-- prof --
-- triv.go --
package main
func main() {}
-- overwrite.go --
package main

import (
	"os"
	"runtime/pprof"
	"time"
)

func main() {
	f, err := os.Create("prof")
	if err != nil {
		panic(err)
	}
	err = pprof.StartCPUProfile(f)
	if err != nil {
		panic(err)
	}
	// Spin to ensure we get some samples. If we get no samples, the result
	// is equivalent to an empty profile.
	start := time.Now()
	for time.Since(start) < 100*time.Millisecond {}
	pprof.StopCPUProfile()
	f.Close()
}

Youez - 2016 - github.com/yon3zu
LinuXploit