Skip to content

Bug: Backticks in magefile package comment breaks mage_output_file.go #537

@thwd

Description

@thwd

Bug Description
I wrote this as a package comment in my magefile.go:

// This is a magefile, to be called with `go tool mage` (github.com/magefile/mage).
package main

What did you do?
I called go tool mage.

What did you expect to happen?
Successful run.

What actually happened?
mage_output_file.go didn't compile.

Environment

$ go tool mage --version
Mage Build Tool <not set>
Build Date: <not set>
Commit: <not set>
built with: go1.26.0

(latest as of today)

Additional context
The line that breaks in mage_output_file.go is:

_fmt.Println(`This is a magefile, to be called with `go tool mage` (github.com/magefile/mage).
`)

The string needs escaping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions