Comments (8)
Probably the simplest thing is to go with what goreleaser provides us with:
So make a version.go file with this in
package main
var (
version = "dev"
commit = "none"
date = "unknown"
)
Then the release builds will have the correct version, commit and date in. The dev builds will have "dev" "none" and "unknown".
Python 3.5.3 (fdd60ed87e941677e8ea11acf9f1819466521bf2, Apr 26 2018, 01:23:42)
[PyPy 6.0.0 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
This provides most of what we need here.
Note that we should show the go runtime version os and arch too as that is really important debugging info.
fmt.Printf("- os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
fmt.Printf("- go version: %s\n", runtime.Version())
from gpython.
@ncw @sbinet
What do you think about displaying build information?
And it will be able to implement it without 3rd party library?
from gpython.
Looks like we can inject the commit log by using ldflag during build time.
from gpython.
This is slightly awkward to do as it can't be done using the standard go build
(at least I haven't figured out how!)
I do this in rclone and I have a Makefile which does the build
https://github.com/ncw/rclone/blob/39eac7a7658494a5404dfd75c80f0be3e6d222b2/Makefile#L35
If you build rclone not via the Makefile you get a v1.45-DEV
build
I'm pretty sure you can do this with go-releaser which we use to build the release binaries.
I had a chat with the debian maintainer about rclone and this issue, and his thoughts were that the program should build using the normal go tools to make the correct version number at the releases. Which kind of implies when we make a release, we should check in the build description. That is what I do in rclone anyway, but the Makefile adds a git ID for non release builds.
from gpython.
@ncw
Yeah looks like rclone
way is the best way from now on.
@sbinet Do you have any ideas?
from gpython.
not sure there's anything else than what rclone
does.
go generate
isn't run by default, so that's out.
if we wanted to also support Windows, we could perhaps use mage
, but that's another tool to install...
so, yeah, the rclone
way is fine by me.
from gpython.
@ncw LGTM
from gpython.
Looks like a good first issue for a newbie of this project.
- Display build information
from gpython.
Related Issues (20)
- Double underlines("_") for nonlocal variable names crash gpython HOT 1
- Large hex_string of pickle.load() crashes gpython HOT 3
- Reassignment of 'getattr' leads to gpython crashing HOT 2
- Annotating types with decorators crashes gpython HOT 1
- '__import__' takes incorrect arguments crashing gpython HOT 1
- Comparing uncomparable types in 'is' crashes gpython HOT 1
- Transforming unsupported types into a set leads to crashing HOT 1
- Defining Nested set crashes gpython HOT 1
- transforming generators into list trigger crashing HOT 1
- Taking large arguments in functions crashes gpython HOT 1
- Compiling long operations crashes gpython HOT 3
- How to get `globals()` inside Go bounded method?
- Set attributes on python objects from Go code HOT 3
- Do you need type conversion of struct? HOT 6
- Can you guys put a pure python library as a built-in library, So the battery will be a built-in feature? HOT 1
- function not found with error AttributeError: "'module' has no attribute 'pre_save'" HOT 2
- Error when i try to get the `__doc__` from a type like `str`
- Support f-string
- `str` is missing `join`, `upper` and `lower` attributes HOT 1
- builtins id dir function not found HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpython.