microcosm-cc / bluemonday

bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS
https://github.com/microcosm-cc/bluemonday
BSD 3-Clause "New" or "Revised" License
3.14k stars 176 forks source link

Support Go Modules #77

Closed SamWhited closed 5 years ago

SamWhited commented 5 years ago

Hello,

Please consider supporting Go Modules, the new packaging standard that will be adopted fully in Go 1.12. Experimental support is in Go 1.11 and the new module paths are supported in Go 1.9.7+ and Go 1.10.3+ in a read-only manner for backwards compatibility with all supported versions of Go.

Because this library is still below version 2 and has few dependencies, the go.mod file is fairly simple. The only other thing that would need to be done if this PR were merged is to create a semver compatible tag (eg. v1.0.2) that users of this library can pin to.

Note that I set the language version go 1.9 in the mod file because 1.9.7 is the earliest version with partial support for reading the go.mod file. If you want to continue to support syntax and APIs from as early as 1.1, I can change it, but the tooling doesn't actually understand these versions yet so to start I just set it to 1.9.

Thank you for your consideration.

buro9 commented 5 years ago

Done, looks sane.

Q: Is there a tool that will update future dependencies and that go.sum file? Or is this done manually?

SamWhited commented 5 years ago

Thanks! Just running go build will update based on any files it touches. To remove unused stuff or add stuff in build tags and what not that would be skipped by a build go mod tidy can be used

SamWhited commented 5 years ago

Oh, and go get -u in module mode will bump versions as you'd expect.

buro9 commented 5 years ago

Perfect, thanks.