go-mod.bbclass 797 B

123456789101112131415161718192021222324
  1. #
  2. # Copyright OpenEmbedded Contributors
  3. #
  4. # Handle Go Modules support
  5. #
  6. # When using Go Modules, the the current working directory MUST be at or below
  7. # the location of the 'go.mod' file when the go tool is used, and there is no
  8. # way to tell it to look elsewhere. It will automatically look upwards for the
  9. # file, but not downwards.
  10. #
  11. # To support this use case, we provide the `GO_WORKDIR` variable, which defaults
  12. # to `GO_IMPORT` but allows for easy override.
  13. #
  14. # Copyright 2020 (C) O.S. Systems Software LTDA.
  15. # The '-modcacherw' option ensures we have write access to the cached objects so
  16. # we avoid errors during clean task as well as when removing the TMPDIR.
  17. GOBUILDFLAGS:append = " -modcacherw"
  18. inherit go
  19. GO_WORKDIR ?= "${GO_IMPORT}"
  20. do_compile[dirs] += "${B}/src/${GO_WORKDIR}"