Skip to content

'go build -trimpath' (from Go 1.13+) breaks AST parsing #4

@meowsbits

Description

@meowsbits

Re: go build -trimpath https://golang.org/doc/go1.13#go-command

This flag reduces the size of the binary and "improves privacy" by stripping the machine-specific paths. However, stripping path information causes the AST traversal required by OpenRPC to fail because runtime.FileLine is unable to provide an absolute path, resulting in file not found errors.

So far, my thinking is that it can be worked around by creating basically an environment variable that etclabscore/go-openrpc-reflect would fall back to in case its AST steps error with "file not found." I'm not sure if there's a way to corroborate that failure at build time with a check against the go build flags, but would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions