Giter VIP home page Giter VIP logo

Comments (4)

mgmacias95 avatar mgmacias95 commented on August 23, 2024 1

Probably it's the homebrew formula which needs to be fixed? https://github.com/Homebrew/homebrew-core/blob/master/Formula/virustotal-cli.rb

from vt-cli.

melomac avatar melomac commented on August 23, 2024

This looks like VERSION isn't set by defaults. On setting VERSION manually, this does work:

vt-cli (master)> make clean
rm -rf ./build

vt-cli (master)> env VERSION=test make
go build -ldflags "-X github.com/VirusTotal/vt-cli/cmd.Version=test" -o ./build/vt ./vt/main.go

vt-cli (master)> ./build/vt version
vt-cli test

Builds attached to this page prints the version number correctly.

Would you please consider a way to setup VERSION on manual build? ex: closest tag dash closest commit

from vt-cli.

melomac avatar melomac commented on August 23, 2024

May be something like this:

diff --git a/Makefile b/Makefile
index 9e76939..a8c9c3a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,15 @@
 # This how we want to name the binary output
 BINARY=./build/vt
 
+COMMIT := $(shell git rev-parse --short HEAD)
+TAG := $(shell git describe --tags $(COMMIT))
+ifneq ($(shell git status --porcelain),)
+    COMMIT := dirty
+endif
+ifeq ($(VERSION),)
+    VERSION := $(TAG)-$(COMMIT)
+endif
+
 # Setup the -ldflags option for go build here, interpolate the variable values
 LDFLAGS=-ldflags "-X github.com/VirusTotal/vt-cli/cmd.Version=${VERSION}"
 

from vt-cli.

mgmacias95 avatar mgmacias95 commented on August 23, 2024

I tried downloading one of the binaries from our release downloads page (https://github.com/VirusTotal/vt-cli/releases/tag/0.10.4) and it worked:

$ ./vt version
vt-cli 0.10.4

The version is set in our release pipeline:

- name: Build
run: make all
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
- name: Create release
run: ./new_release.sh
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}

from vt-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.