aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2024-02-15 23:59:52 -0500
committerGopher Robot <gobot@golang.org>2024-02-16 15:19:53 +0000
commit63dd79c07b0026b58f421a5273c41e705ccb73d1 (patch)
tree78ae03458e1b1f1ea8e3dde24533f6b4eb1af94e /src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
parent3b51581261704bfc3e6feeb29b6d2588b163777d (diff)
downloadgo-63dd79c07b0026b58f421a5273c41e705ccb73d1.tar.xz
cmd/pprof: update vendored github.com/google/pprof
Pull in the latest published version of github.com/google/pprof as part of the continuous process of keeping Go's dependencies up to date. Done with: go get github.com/google/pprof go mod tidy go mod vendor For #36905. Fixes #65741. Change-Id: Ice7b085c03ff69be97929cbe47bfd91954907529 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/564636 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go')
-rw-r--r--src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
index 584c5d85e0..95204a394f 100644
--- a/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
+++ b/src/cmd/vendor/github.com/google/pprof/internal/driver/fetch.go
@@ -492,17 +492,23 @@ mapping:
func fetch(source string, duration, timeout time.Duration, ui plugin.UI, tr http.RoundTripper) (p *profile.Profile, src string, err error) {
var f io.ReadCloser
- if sourceURL, timeout := adjustURL(source, duration, timeout); sourceURL != "" {
- ui.Print("Fetching profile over HTTP from " + sourceURL)
- if duration > 0 {
- ui.Print(fmt.Sprintf("Please wait... (%v)", duration))
+ // First determine whether the source is a file, if not, it will be treated as a URL.
+ if _, openErr := os.Stat(source); openErr == nil {
+ if isPerfFile(source) {
+ f, err = convertPerfData(source, ui)
+ } else {
+ f, err = os.Open(source)
}
- f, err = fetchURL(sourceURL, timeout, tr)
- src = sourceURL
- } else if isPerfFile(source) {
- f, err = convertPerfData(source, ui)
} else {
- f, err = os.Open(source)
+ sourceURL, timeout := adjustURL(source, duration, timeout)
+ if sourceURL != "" {
+ ui.Print("Fetching profile over HTTP from " + sourceURL)
+ if duration > 0 {
+ ui.Print(fmt.Sprintf("Please wait... (%v)", duration))
+ }
+ f, err = fetchURL(sourceURL, timeout, tr)
+ src = sourceURL
+ }
}
if err == nil {
defer f.Close()