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

Set build version and git revision using -ldflags

    XMLWordPrintable

    Details

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

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: