A utility to extract go build info information fro go executables and shared libraries
Project description
A python package that extracts go build information from go based executables and shared libraries. The package leverages the golang debug/buildinfo package to extract the information hence reliaes on a shared library to do this work.
Example usage
import pygobuildinfo
import json
def test_get_info(file):
res = pygobuildinfo.get_go_build_info(file)
print(json.dumps(res, indent=4))
test_get_info("foo/bar")
test_get_info("/usr/bin/du")
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider.elf")
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider.exe")
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider")
test_get_info("/Users/auser/go/pygobuildinfo/pybuildInfo/_pyGoBuildinfo.cpython-39-darwin.so")
The result returned is always a dict object for errors the dictionary returned contains a key; "error" like;
{
"error": "path error:foo/bar"
}
or
{
"error": "/usr/bin/du: could not read Go build info from /usr/bin/du: unrecognized file format"
}
on success a python dict of the buildinfo struct is returned
{
"GoVersion": "go1.18.4",
"Path": "github.com/spiffe/spire/support/oidc-discovery-provider",
"Main": {
"Path": "github.com/spiffe/spire",
"Version": "(devel)",
"Sum": "",
"Replace": null
},
"Deps": [
{
"Path": "github.com/DataDog/datadog-go",
"Version": "v3.2.0+incompatible",
"Sum": "h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=",
"Replace": null
},
{
"Path": "github.com/andres-erbsen/clock",
"Version": "v0.0.0-20160526145045-9e14626cd129",
"Sum": "h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI=",
"Replace": null
},
{
"Path": "github.com/armon/go-metrics",
"Version": "v0.4.0",
"Sum": "h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q=",
"Replace": null
},
{
"Path": "github.com/beorn7/perks",
"Version": "v1.0.1",
"Sum": "h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=",
"Replace": null
},
{
"Path": "github.com/cespare/xxhash/v2",
"Version": "v2.1.2",
"Sum": "h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=",
"Replace": null
},
{
"Path": "github.com/fatih/color",
"Version": "v1.13.0",
"Sum": "h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=",
"Replace": null
},
{
"Path": "github.com/felixge/httpsnoop",
"Version": "v1.0.2",
"Sum": "h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=",
"Replace": null
},
{
"Path": "github.com/golang/protobuf",
"Version": "v1.5.2",
"Sum": "h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=",
"Replace": null
},
{
"Path": "github.com/gorilla/handlers",
"Version": "v1.5.1",
"Sum": "h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=",
"Replace": null
},
{
"Path": "github.com/hashicorp/go-hclog",
"Version": "v1.2.1",
"Sum": "h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw=",
"Replace": null
},
{
"Path": "github.com/hashicorp/go-immutable-radix",
"Version": "v1.3.1",
"Sum": "h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=",
"Replace": null
},
{
"Path": "github.com/hashicorp/golang-lru",
"Version": "v0.5.4",
"Sum": "h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=",
"Replace": null
},
{
"Path": "github.com/hashicorp/hcl",
"Version": "v1.0.1-0.20190430135223-99e2f22d1c94",
"Sum": "h1:LaH4JWe6Q7ICdxL5raxQjSRw7Pj8uTtAENrjejIYZIg=",
"Replace": null
},
{
"Path": "github.com/mattn/go-colorable",
"Version": "v0.1.12",
"Sum": "h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=",
"Replace": null
},
{
"Path": "github.com/mattn/go-isatty",
"Version": "v0.0.14",
"Sum": "h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=",
"Replace": null
},
{
"Path": "github.com/matttproud/golang_protobuf_extensions",
"Version": "v1.0.2-0.20181231171920-c182affec369",
"Sum": "h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=",
"Replace": null
},
{
"Path": "github.com/pkg/errors",
"Version": "v0.9.1",
"Sum": "h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=",
"Replace": null
},
{
"Path": "github.com/prometheus/client_golang",
"Version": "v1.12.2",
"Sum": "h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34=",
"Replace": null
},
{
"Path": "github.com/prometheus/client_model",
"Version": "v0.2.0",
"Sum": "h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=",
"Replace": null
},
{
"Path": "github.com/prometheus/common",
"Version": "v0.32.1",
"Sum": "h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4=",
"Replace": null
},
{
"Path": "github.com/prometheus/procfs",
"Version": "v0.7.3",
"Sum": "h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=",
"Replace": null
},
{
"Path": "github.com/sirupsen/logrus",
"Version": "v1.8.1",
"Sum": "h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=",
"Replace": null
},
{
"Path": "github.com/spiffe/go-spiffe/v2",
"Version": "v2.0.1-0.20220414143532-2ed460a8b9d3",
"Sum": "h1:FpqM5PfWHs4Ze36HwzMpRefrv8kkmxFgtG9Qc6hL7Dc=",
"Replace": null
},
{
"Path": "github.com/spiffe/spire-api-sdk",
"Version": "v1.2.2-0.20220317172821-e2705b35aa09",
"Sum": "h1:2oavALIvyKv+M9Q2CWoz3UlJn4DT+oAhVO1qIgaq0GA=",
"Replace": null
},
{
"Path": "github.com/twmb/murmur3",
"Version": "v1.1.6",
"Sum": "h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg=",
"Replace": null
},
{
"Path": "github.com/uber-go/tally/v4",
"Version": "v4.1.2",
"Sum": "h1:NlU/4j+AAaPHG7yxQVmu0QY7H0W9FFDjFznwAU0t+rE=",
"Replace": null
},
{
"Path": "github.com/zeebo/errs",
"Version": "v1.3.0",
"Sum": "h1:hmiaKqgYZzcVgRL1Vkc1Mn2914BbzB0IBxs+ebeutGs=",
"Replace": null
},
{
"Path": "go.uber.org/atomic",
"Version": "v1.9.0",
"Sum": "h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=",
"Replace": null
},
{
"Path": "golang.org/x/crypto",
"Version": "v0.0.0-20220511200225-c6db032c6c88",
"Sum": "h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw=",
"Replace": null
},
{
"Path": "golang.org/x/net",
"Version": "v0.0.0-20220624214902-1bab6f366d9e",
"Sum": "h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ=",
"Replace": null
},
{
"Path": "golang.org/x/sys",
"Version": "v0.0.0-20220624220833-87e55d714810",
"Sum": "h1:rHZQSjJdAI4Xf5Qzeh2bBc5YJIkPFVM6oDtMFYmgws0=",
"Replace": null
},
{
"Path": "golang.org/x/text",
"Version": "v0.3.7",
"Sum": "h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=",
"Replace": null
},
{
"Path": "google.golang.org/genproto",
"Version": "v0.0.0-20220624142145-8cd45d7dbd1f",
"Sum": "h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o=",
"Replace": null
},
{
"Path": "google.golang.org/grpc",
"Version": "v1.47.0",
"Sum": "h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=",
"Replace": null
},
{
"Path": "google.golang.org/protobuf",
"Version": "v1.28.0",
"Sum": "h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=",
"Replace": null
},
{
"Path": "gopkg.in/square/go-jose.v2",
"Version": "v2.6.0",
"Sum": "h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=",
"Replace": null
}
],
"Settings": [
{
"Key": "-compiler",
"Value": "gc"
},
{
"Key": "CGO_ENABLED",
"Value": "0"
},
{
"Key": "GOARCH",
"Value": "amd64"
},
{
"Key": "GOOS",
"Value": "linux"
},
{
"Key": "GOAMD64",
"Value": "v1"
},
{
"Key": "vcs",
"Value": "git"
},
{
"Key": "vcs.revision",
"Value": "6cdc33ac0c19ca30b9e76313e8f17cfba0c86996"
},
{
"Key": "vcs.time",
"Value": "2022-07-13T19:09:00Z"
},
{
"Key": "vcs.modified",
"Value": "true"
}
]
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pygobuildinfo-0.1.5.tar.gz
(7.6 kB
view hashes)
Built Distributions
Close
Hashes for pygobuildinfo-0.1.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ed66d0babea18d4270f54ec12f92330750f57767a4f01393958ce8761d4553f |
|
MD5 | 5b866a2d1427f040ff27d6e087faf778 |
|
BLAKE2b-256 | b16762d938153481b4c884e78f3b72ce567b9c0a6a628445b223bb55102b5ef6 |
Close
Hashes for pygobuildinfo-0.1.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1cbe1d023c7a89d244e42078afa9416b6ebfdc93c856c64afd89daee0c781df |
|
MD5 | 570d593a935b60ec333f5d2a60c921ab |
|
BLAKE2b-256 | b847eace23645be6f782995e0f550afe720f766152ae4bebbad0be695bdd6e39 |
Close
Hashes for pygobuildinfo-0.1.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb637eb276877846a9885ba66766cf9ba725d100b246c5e39e1764f3730b0e8a |
|
MD5 | adb954d2f68922e5ae8dd7937b367bc9 |
|
BLAKE2b-256 | e94e78f2af9850e718eff8138f86efd488193199e54047dc27fb75c2f5c3e966 |
Close
Hashes for pygobuildinfo-0.1.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 729e01ffe64a346bc1289f181720bcd404f59643bb7dd96cdd10f4dcd455e9de |
|
MD5 | 73782765a21a792a17243d864b00d803 |
|
BLAKE2b-256 | 23da9d9a7fba0a89691123964a75f8412e7525b53947e27e4cda882fea1ccd17 |
Close
Hashes for pygobuildinfo-0.1.5-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a07036ffead22921acc172d0b0242d4d06d8eb0fc32886c15958e1434380540a |
|
MD5 | ae955fd7e0ba3503348f28f9b81aa260 |
|
BLAKE2b-256 | 8f649ef3a50db09cbd9360b314bbe42791ef67a3a18250b138b8a42343ef42e6 |