jondot / goweight

A tool to analyze and troubleshoot a Go binary size.
MIT License
1.7k stars 49 forks source link

Always getting `operation not permitted` all projects #19

Open Dentrax opened 3 years ago

Dentrax commented 3 years ago

I am getting an error while trying this out on an example project. Any ideas?

  1. $ git clone https://github.com/jondot/goweight
  2. Jump to your project
  3. $ goweight
  4. See the error: operation not permitted

macOS - Go v1.15.5

guschnwg commented 3 years ago

Go with sudo. Not ideal, but works. Probably macOS blocks something that goweight uses.

➜  golang git:(main) goweight cmd/server/main.go                                                                
2021/01/27 20:02:01 operation not permitted
➜  golang git:(main) sudo goweight cmd/server/main.go
   22 MB github.com/maxence-charriere/go-app/v7/pkg/app
  4.0 MB net/http
  3.9 MB runtime
  ...
Nv7-GitHub commented 3 years ago

It was working with sudo earlier, but now it doesn't even work with sudo. It is printing with a timestamp though, so it seems different. Now it is doing 2021/03/14 17:42:33 operation not permitted

yankeexe commented 3 years ago

Same on Linux system as well. Shows the following error:

2021/07/09 12:09:50 permission denied
Dentrax commented 2 years ago

Any updates? @jondot

Bevisy commented 2 months ago

Any updates? @jondot

The reason is that there is a problem with the level of directory traversal. You can fix this by:

    // add "/" suffix to work directory, or zenv root directory will be wrong
    modules := weight.Process(work + "/")

Or you can use the fork version https://github.com/Bevisy/goweight .