1

I'm working on this PR(https://github.com/gin-contrib/i18n/pull/7) and it uses embed package which was supported from go 1.16(https://tip.golang.org/doc/go1.16#library-embed). As the gin-contrib/i18n package support go version from go 1.13, I want to make it skip build and test for embed if go version < 1.16. What should I do? I tried using build tag like

//go:build go1.16 

but this approach doesn't work as I expected. Thanks in advance.

1
  • 1
    Pre 1.17 build tags had a different format, example: // +build go1.9. Commented Mar 10, 2022 at 15:17

1 Answer 1

2

as mentioned in the docs. //go:build constraint is included in Go 1.16, use also // +build go1.16.

This package parses both the original “// +build” syntax and the “//go:build” syntax that will be added in Go 1.17. The parser is being included in Go 1.16 to allow tools that need to process Go 1.17 source code to still be built against the Go 1.16 release. See https://golang.org/design/draft-gobuild for details about the “//go:build” syntax.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much. My problem has been solved!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.