This is what i did:
1. Enabled net/http/pprof on server.
3. Copied profile.proto file from github/pprof/proto into current directory.
4. Generated profile.pb.go by: protoc profile.proto --go_out .
5. Read "cpu-profile-over-http.gz" by: go run profile.pb.go main.go, where main.go is
package main
import (
"compress/gzip"
"fmt"
"io/ioutil"
"os"
)
func main() {
f, err := os.Open("cpu-profile-over-http.gz")
if err != nil {
panic(err)
}
r, err := gzip.NewReader(f)
if err != nil {
panic(err)
}
data, err := ioutil.ReadAll(r)
if err != nil {
panic(err)
}
p := Profile{}
err = proto.Unmarshal(data, &p)
if err != nil {
panic(err)
}
fmt.Println(p)
}
The output of which seems correct.
Did you take similar steps? If no, then try this. Otherwise we would need to look at some other angle.
-----
On the other hand it seems the error you mentioned "bad wiretype for field ..." is present in v1.0.0 and not in v1.1.0 (latest) of protobuf.
If you're using old version, consider upgrading protobuf to v1.1.0 (check releases in github)