Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Overriding the version of oapi-codegen

Why?

oapi-codegen uses the standard Go means to determine what the version of the binary is.

However, this doesn't work when there's no Version Control System (VCS), for instance when building from a source bundle.

This example shows how to override the version at build-time.

How?

By specifying -ldflags for the noVCSVersionOverride when running go build or go run:

go run -ldflags "-X main.noVCSVersionOverride=v123.456.789" ./cmd/oapi-codegen --config=config.yaml ../../api.yaml