Golang newbie - keen to contribute

Last updated: 2024-02-03T22:54:01-08:00

This post is outdated. Please refer to the build from source section of the Hugo installation instructions for Windows.


When building the extended flavor of Hugo from source on Windows, you will need Go and the GCC compiler.

To install the GCC compiler:

  1. Download and install 7-Zip.

  2. Download Mingw-w64. You want the file with “posix-seh” in its name.

  3. Extract the archive with 7-Zip, then move the mingw64 directory to the root of your C:\ drive.

    C:\MINGW64
    ├───bin
    ├───etc
    ├───include
    ├───lib
    ├───libexec 
    ├───licenses
    ├───opt
    ├───share
    └───x86_64-w64-mingw32
    
  4. Update the PATH environment variable

    • Right click on the Start menu icon, choose Run, then paste:

      rundll32.exe sysdm.cpl,EditEnvironmentVariables

    • Under “User variables” select PATH, press Edit, press New, then paste:

      C:\mingw64\bin

  5. Verify that gcc is installed and in your PATH. Open a cmd window then type:

    gcc --version

  6. Now compile the extended version of Hugo. Change to the directory containing the Hugo codebase, then type:

    go install -tags extended

    Be patient; it will take a while.

  7. Verify the location of the executable by typing where hugo. This should display something like:

    C:\Users\joe\go\bin\hugo.exe

  8. Verify the version by typing hugo version. This should display something like:

    hugo v0.106.0-DEV-52ea07d2eb9c581015f85c0d2d6973640a62281b+extended windows/amd64 BuildDate=2022-11-01T17:45:34Z

3 Likes