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 {
|
func runImp(root, ignore string, write, gofumpt, gofumptExtra bool) error {
|
||||||
mod, err := modInfo(root)
|
mod := modInfo(root)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
globs, err := globber.ParseFile(ignore)
|
globs, err := globber.ParseFile(ignore)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errors.Is(err, fs.ErrNotExist) {
|
if !errors.Is(err, fs.ErrNotExist) {
|
||||||
|
|
15
main.go
15
main.go
|
@ -38,10 +38,7 @@ func mainErr() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *stdinFlag {
|
if *stdinFlag {
|
||||||
mod, err := modInfo(cwd)
|
mod := modInfo(cwd)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
src, err := io.ReadAll(os.Stdin)
|
src, err := io.ReadAll(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -85,17 +82,15 @@ func (m *module) UnmarshalJSON(data []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func modInfo(dir string) (module, error) {
|
func modInfo(dir string) module {
|
||||||
cmd := exec.Command("go", "mod", "edit", "--json")
|
cmd := exec.Command("go", "mod", "edit", "--json")
|
||||||
cmd.Dir = dir
|
cmd.Dir = dir
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return module{}, err
|
return module{}
|
||||||
}
|
}
|
||||||
|
|
||||||
var m module
|
var m module
|
||||||
if err := json.Unmarshal(out, &m); err != nil {
|
_ = json.Unmarshal(out, &m)
|
||||||
return m, err
|
return m
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue