rivo / uniseg

Unicode Text Segmentation, Word Wrapping, and String Width Calculation in Go
MIT License
570 stars 60 forks source link

fix position of `Code generated` comments. #35

Closed shogo82148 closed 12 months ago

shogo82148 commented 1 year ago

Go extension of VSCode warns when I modify the generated codes:

This file seems to be generated. DO NOT EDIT.

However, this feature doesn't work with this project. For example, I've modified emojipresentation.go that is generated by gen_properties.go, but I never see any warning message. It seems that the Go extension doesn't understand emojipresentation.go is generated code.

According to the document of go generate, // Code generated comments must appear earlier.

https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source

To convey to humans and machine tools that code is generated, generated source should have a line that matches the following regular expression (in Go syntax):

^// Code generated .* DO NOT EDIT\.$

This line must appear before the first non-comment, non-blank text in the file.