Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: use runtime.Version() to get Go version #53619

Merged
merged 2 commits into from
May 29, 2024

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented May 28, 2024

What problem does this PR solve?

Issue Number: close #53618

Problem Summary:

Related:

Alternative solution (not chosen):

diff --git a/Makefile.common b/Makefile.common
index b540debd42..bab0acd3c9 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -71,6 +71,7 @@ LDFLAGS += -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBBuildTS=$(shell
 LDFLAGS += -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitHash=$(shell git rev-parse HEAD)"
 LDFLAGS += -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
 LDFLAGS += -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBEdition=$(TIDB_EDITION)"
+LDFLAGS += "-checklinkname=0"
 
 EXTENSION_FLAG =
 ifeq ($(shell if [ -f pkg/extension/enterprise/.git ]; then echo "true"; fi),true)

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 28, 2024
Copy link

tiprow bot commented May 28, 2024

Hi @dveeden. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@dveeden
Copy link
Contributor Author

dveeden commented May 28, 2024

$ make GO=gotip server && ./bin/tidb-server -V
CGO_ENABLED=1  gotip build -tags codes  -ldflags '-X "github.com/pingcap/tidb/pkg/parser/mysql.TiDBReleaseVersion=v8.2.0-alpha-246-gbdb0545f73-dirty" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBBuildTS=2024-05-28 07:30:49" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitHash=bdb0545f73349ac5ce0a96f9397500d3f3e9a58f" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBGitBranch=master" -X "github.com/pingcap/tidb/pkg/util/versioninfo.TiDBEdition=Community" ' -o bin/tidb-server ./cmd/tidb-server
Release Version: v8.2.0-alpha-246-gbdb0545f73-dirty
Edition: Community
Git Commit Hash: bdb0545f73349ac5ce0a96f9397500d3f3e9a58f
Git Branch: master
UTC Build Time: 2024-05-28 07:30:49
GoVersion: devel go1.23-37764658 Fri May 24 22:23:55 2024 +0000
Race Enabled: false
Check Table Before Drop: false
Store: unistore

@dveeden
Copy link
Contributor Author

dveeden commented May 28, 2024

/check-issue-triage-complete

Copy link

codecov bot commented May 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.7330%. Comparing base (bdb0545) to head (c78e4e4).
Report is 8 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53619        +/-   ##
================================================
+ Coverage   72.4359%   74.7330%   +2.2970%     
================================================
  Files          1506       1506                
  Lines        430579     433728      +3149     
================================================
+ Hits         311894     324138     +12244     
+ Misses        99367      89732      -9635     
- Partials      19318      19858       +540     
Flag Coverage Δ
integration 49.6981% <100.0000%> (?)
unit 71.4249% <100.0000%> (+0.0127%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 50.4674% <ø> (+9.0192%) ⬆️

@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label May 28, 2024
@dveeden
Copy link
Contributor Author

dveeden commented May 28, 2024

This also causes issues for pingcap/tiflow:

$ make GO=gotip cdc dm
CGO_ENABLED=0 gotip build  -trimpath  -ldflags '-X "github.com/pingcap/tiflow/pkg/version.ReleaseVersion=v8.2.0-master-dirty" -X "github.com/pingcap/tiflow/pkg/version.BuildTS=2024-05-28 08:12:48" -X "github.com/pingcap/tiflow/pkg/version.GitHash=327b89a0831e53b64e235bcfac3e224cd0b83d10" -X "github.com/pingcap/tiflow/pkg/version.GitBranch=master" -X "github.com/pingcap/tiflow/pkg/version.GoVersion=go version go1.22.3 linux/amd64" -X "github.com/pingcap/tidb/pkg/parser/mysql.TiDBReleaseVersion=v8.2.0-master-dirty"' -o bin/cdc ./cmd/cdc
go: downloading github.com/pingcap/tidb v1.1.0-beta.0.20240520031014-397a460dd067
go: downloading github.com/pingcap/tidb/pkg/parser v0.0.0-20240520031014-397a460dd067
# github.com/pingcap/tiflow/cmd/cdc
link: github.com/pingcap/tidb/pkg/util/printer: invalid reference to runtime.buildVersion
make: *** [Makefile:165: cdc] Error 1

So we need to update the dependency once this has been resolved. And the same for pingcap/tidb-tools.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 28, 2024
Copy link

ti-chi-bot bot commented May 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, lance6716

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [hawkingrei,lance6716]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 29, 2024
Copy link

ti-chi-bot bot commented May 29, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-28 09:18:38.842511481 +0000 UTC m=+2768072.599647055: ☑️ agreed by hawkingrei.
  • 2024-05-29 02:24:05.373342265 +0000 UTC m=+2829599.130477831: ☑️ agreed by lance6716.

@ti-chi-bot ti-chi-bot bot merged commit afd2343 into pingcap:master May 29, 2024
23 checks passed
@Defined2014 Defined2014 added needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. labels Aug 20, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #55533.

@Defined2014 Defined2014 added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Aug 20, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #55534.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #55535.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #55536.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiDB fails to build with gotip
5 participants