| 1234567891011121314151617181920212223242526272829 |
- package preprocessor
- import (
- "fmt"
- cbchelper "git.buran.team/main/cbc/helper"
- cbcscheme "git.buran.team/main/cbc/scheme"
- )
- type GoFmtPreprocessor struct {
- }
- func NewGoFmtPreprocessor(preprocessorScheme cbcscheme.TaskPreprocessor) (*GoFmtPreprocessor, error) {
- return &GoFmtPreprocessor{}, nil
- }
- func (this *GoFmtPreprocessor) Process(path string) ([]byte, []byte, error) {
- stdout, stderr, err := cbchelper.Execute(
- fmt.Sprintf(
- "gofmt -e %s",
- path,
- ),
- )
- if err != nil {
- return nil, nil, fmt.Errorf("can't gofmt over program: %w", err)
- }
- return stdout, stderr, nil
- }
|