Skip to content

go mod tidy will remove the reference to github.com/dmarkham/enumer from go.mod #77

Closed

Description

@madkins23

This can be prevented by adding a tools.go file:

//go:build tools

package tools

import (
	// Protect this entry in go.mod from being removed by go mod tidy.
	_ "github.com/dmarkham/enumer"
)

Should probably go into README.md.

Activity

  1. changed the title [-]Minor documentation tweak[/-] [+]go mod tidy will remove the reference to github.com/dmarkham/enumer from go.mod[/+] on Jun 25, 2023
  2. theclapp commented on Oct 11, 2024

    @theclapp

    Context: The README currently says

    For a module-aware repo with enumer in the go.mod file, generation can be called by adding the following to a .go source file:

    //go:generate go run github.com/dmarkham/enumer -type=YOURTYPE
    

    so that's why you might want enumer in your go.mod.

  3. self-assigned this
    on Oct 12, 2024
  4. samiam2013 commented on Aug 15, 2025

    @samiam2013
    Contributor

    Could also be solved in a PR for issue #113 in conjunction with #91

  5. removed their assignment
    on Apr 22, 2026
  6. dmarkham commented on Oct 3, 2026

    @dmarkham
    Owner

    Fixed in #127. The README now uses the Go 1.24 tool directive:

        go get -tool github.com/dmarkham/enumer@latest
        //go:generate go tool enumer -type=Pill
    
    

    go mod tidy keeps the dependency, so the tools.go workaround is no longer needed. Thanks for raising it. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions