fix: empty module
ci/woodpecker/push/goreleaser Pipeline was successful
Details
ci/woodpecker/push/goreleaser Pipeline was successful
Details
Signed-off-by: jolheiser <john.olheiser@gmail.com>main v0.0.8
parent
49a668d1a9
commit
587759243a
5
imp.go
5
imp.go
|
@ -16,10 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func runImp(root, ignore string, write, gofumpt, gofumptExtra bool) error {
|
||||
mod, err := modInfo(root)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mod := modInfo(root)
|
||||
globs, err := globber.ParseFile(ignore)
|
||||
if err != nil {
|
||||
if !errors.Is(err, fs.ErrNotExist) {
|
||||
|
|
15
main.go
15
main.go
|
@ -38,10 +38,7 @@ func mainErr() error {
|
|||
}
|
||||
|
||||
if *stdinFlag {
|
||||
mod, err := modInfo(cwd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mod := modInfo(cwd)
|
||||
src, err := io.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -85,17 +82,15 @@ func (m *module) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func modInfo(dir string) (module, error) {
|
||||
func modInfo(dir string) module {
|
||||
cmd := exec.Command("go", "mod", "edit", "--json")
|
||||
cmd.Dir = dir
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
return module{}, err
|
||||
return module{}
|
||||
}
|
||||
|
||||
var m module
|
||||
if err := json.Unmarshal(out, &m); err != nil {
|
||||
return m, err
|
||||
}
|
||||
return m, nil
|
||||
_ = json.Unmarshal(out, &m)
|
||||
return m
|
||||
}
|
||||
|
|
Reference in New Issue