preprocessor_go_mod_vendor.go 640 B

1234567891011121314151617181920212223242526272829
  1. package preprocessor
  2. import (
  3. "fmt"
  4. cbchelper "git.buran.team/main/cbc/helper"
  5. cbcscheme "git.buran.team/main/cbc/scheme"
  6. )
  7. type GoModVendorPreprocessor struct {
  8. }
  9. func NewGoModVendorPreprocessor(preprocessorScheme cbcscheme.TaskPreprocessor) (*GoModVendorPreprocessor, error) {
  10. return &GoModVendorPreprocessor{}, nil
  11. }
  12. func (this *GoModVendorPreprocessor) Process(path string) ([]byte, []byte, error) {
  13. stdout, stderr, err := cbchelper.Execute(
  14. fmt.Sprintf(
  15. "go -C %s mod vendor",
  16. path,
  17. ),
  18. )
  19. if err != nil {
  20. return nil, nil, fmt.Errorf("can't go mod vendor over program: %w", err)
  21. }
  22. return stdout, stderr, nil
  23. }