Skip to content

Changing imports removes comment at the top of a file #54

@breml

Description

@breml

Given a Go source file with a comment at the top of the file (not a package comment):

// Copyright 2022 ...

package main

import (
	"cmd/internal/edit"
)

func main() {
	_ = edit.Buffer
}

and a patch to modify the imports:

@@
var randomIdentifier identifier
@@
-import "cmd/internal/edit"
+import "github.com/foo/bar/internal/edit"

edit.randomIdentifier

the comment at the top is removed by gopatch, resulting with the following file:

package main

import "github.com/foo/bar/internal/edit"

func main() {
	_ = edit.Buffer
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions