Hmm. I just built fine on Windows 10. But I use mage. Here’s my batch build script if it’s helpful.
Build script
@echo off
REM set HUGO_BUILD_TAGS=extended
set HUGO_BUILD_TAGS=
if exist "src\hugo" (
echo ==================================================
echo Hugo repo is already cloned, pulling latest
echo ==================================================
) else (
echo ==================================================
echo Hugo repo not found, cloning it
echo ==================================================
git clone https://github.com/gohugoio/hugo.git src/hugo
echo.
)
cd src\hugo
git pull
echo.
echo ==================================================
echo Building Hugo binary
echo ==================================================
go get github.com/magefile/mage
go mod download
mage -v hugo
echo.
echo ==================================================
echo Hugo binary version
echo ==================================================
ren hugo.exe hugodev.exe
hugodev.exe version
echo.
echo ==================================================
echo Copying Hugo binary (hugo.exe) to C:\Hugo\bin
echo ==================================================
xcopy /y hugodev.exe C:\Hugo\bin\
echo.
cd ..\..
Go works off of Git. If you git clone a repo, by default you get the latest commit from the default branch. Typically this is master, which is the development branch. If you wanted to build a specific release, you’d need to download the source tarball from the releases page or git checkout a Git tag corresponding to the release.
For example, to checkout the source code for Hugo v0.53, you would do git checkout v0.53. Then, you could go build or go install that source and it would be Hugo at that version.