Wrong version information in 1.5.1 #2387

Closed
opened 2025-11-02 04:34:29 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @pvgoran on GitHub (Oct 7, 2018).

  • Gitea version (or commit ref): 1.5.1
  • Git version: (irrelevant)
  • Operating system: (irrelevant)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

https://github.com/go-gitea/gitea/blob/v1.5.1/main.go#L24 says:

var Version = "1.5.0-dev"

So Gitea shows a wrong version in logs, in the Web interface, and in CLI, for example:

> /nix/store/rc2ajcxinkmnkdas78563vra7v1a8nsb-gitea-1.5.1-bin/bin/gitea --version
Gitea version 1.5.0-dev
Originally created by @pvgoran on GitHub (Oct 7, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.5.1 - Git version: (irrelevant) - Operating system: (irrelevant) - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description https://github.com/go-gitea/gitea/blob/v1.5.1/main.go#L24 says: ``` var Version = "1.5.0-dev" ``` So Gitea shows a wrong version in logs, in the Web interface, and in CLI, for example: ``` > /nix/store/rc2ajcxinkmnkdas78563vra7v1a8nsb-gitea-1.5.1-bin/bin/gitea --version Gitea version 1.5.0-dev ```
GiteaMirror added the type/question label 2025-11-02 04:34:29 -06:00
Author
Owner

@coolaj86 commented on GitHub (Oct 7, 2018):

Did you do TAGS="bindata" make generate all when building?

If you just run go build it'll use the literals in main.go. If you run the makefile, it'll build with the dynamic strings as expected.

See https://www.atatus.com/blog/golang-auto-build-versioning/

@coolaj86 commented on GitHub (Oct 7, 2018): Did you do `TAGS="bindata" make generate all` when building? If you just run `go build` it'll use the literals in `main.go`. If you run the makefile, it'll build with the dynamic strings as expected. See https://www.atatus.com/blog/golang-auto-build-versioning/
Author
Owner

@pvgoran commented on GitHub (Oct 9, 2018):

Did you do TAGS="bindata" make generate all when building?

Well, it was built as part of Nixos distribution, and frankly, I don't know whether it was go build or make or something other (the go build specifics in Nixos are quite confusing to my untrained eye).

If you just run go build it'll use the literals in main.go. If you run the makefile, it'll build with the dynamic strings as expected.

So, the "wrong" version in the source file is by design, then...

When building gitea with the recommended/expected way, where does the build system get the version number to use? From the version control system?

@pvgoran commented on GitHub (Oct 9, 2018): > Did you do `TAGS="bindata" make generate all` when building? Well, it was built as part of [Nixos distribution](https://nixos.org/), and frankly, I don't know whether it was `go build` or `make` or something other (the go build specifics in Nixos are quite confusing to my untrained eye). > If you just run `go build` it'll use the literals in `main.go`. If you run the makefile, it'll build with the dynamic strings as expected. So, the "wrong" version in the source file is by design, then... When building gitea with the recommended/expected way, where does the build system get the version number to use? From the version control system?
Author
Owner

@techknowlogick commented on GitHub (Oct 9, 2018):

Here is the line of the make file that injects the version: https://github.com/go-gitea/gitea/blob/master/Makefile#L36 (based on CI server for gitea, and if that is not available then based on git). It's not wrong by design, as running go build directly isn't part of design, the project recommends using the make file to build project.

Please use the forum for any follow up discussion.

@techknowlogick commented on GitHub (Oct 9, 2018): Here is the line of the make file that injects the version: https://github.com/go-gitea/gitea/blob/master/Makefile#L36 (based on CI server for gitea, and if that is not available then based on git). It's not wrong by design, as running `go build` directly isn't part of design, the project recommends using the make file to build project. Please use the [forum](https://discourse.gitea.io/) for any follow up discussion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2387