@@ -492,8 +492,6 @@ func FinalizeRemovals(file *ast.File) {
492492// build constraints or any file level directives, but simply append
493493// the tail comments as is. This may cause issues when formatting
494494// the resulting file including extra newlines or invalid code.
495- // - The file end will be set to the end of the last tail file that
496- // will be from a different file according to the FileSet.
497495func ConcatenateFiles (file * ast.File , tails ... * ast.File ) error {
498496 // Populate the imports map from the target file.
499497 // This map will be used to check for duplicate imports.
@@ -518,15 +516,6 @@ func ConcatenateFiles(file *ast.File, tails ...*ast.File) error {
518516 return fmt .Errorf ("can not concatenate files with different package names: %q != %q" , file .Name .Name , tail .Name .Name )
519517 }
520518
521- // Check go version from build constraints, e.g. `//go:build go1.18`
522- // We probably could merge different versions of Go,
523- // but it's better to know when it happens and handle it.
524- if len (file .GoVersion ) == 0 {
525- file .GoVersion = tail .GoVersion
526- } else if len (tail .GoVersion ) > 0 && file .GoVersion != tail .GoVersion {
527- return fmt .Errorf ("can not concatenate files with different Go versions: %q != %q" , file .GoVersion , tail .GoVersion )
528- }
529-
530519 // Concatenate the imports.
531520 for _ , imp := range tail .Imports {
532521 path := imp .Path .Value
@@ -560,9 +549,6 @@ func ConcatenateFiles(file *ast.File, tails ...*ast.File) error {
560549 file .Package = tail .Package
561550 file .Name .NamePos = tail .Name .NamePos
562551 }
563-
564- // Update the file end to the new end.
565- file .FileEnd = tail .FileEnd
566552 }
567553
568554 // Update the target file's declarations with all the imports
0 commit comments