Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1709

Set build version and git revision using -ldflags

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.1, 3.4.19, 4.0.5, 3.6.10
    • Affects Version/s: None
    • Component/s: All Tools
    • None

      Currently we edit the variable in the source file using sed in the build.sh script. go allows you to set variables at link time using:

      go build -ldflags "-X {package}.{ConstName}={value}"
      

      We should adopt this pattern in our build.sh script to prevent changing the source code.

      Blog post describing this process.

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            william.banfield William Banfield
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: