github.com/yoogoc/kratos-scaffold@v0.0.0-20240402032722-a538b3c18955/project_generator/service.go (about) 1 package project_generator 2 3 import ( 4 "os" 5 "path" 6 ) 7 8 func genService(appPath string) error { 9 servicePath := path.Join(appPath, "service") 10 if err := os.MkdirAll(servicePath, 0o700); err != nil { 11 return err 12 } 13 serviceContent := `package service 14 15 import "github.com/google/wire" 16 17 // ProviderSet is service providers. 18 var ProviderSet = wire.NewSet() 19 ` 20 if err := os.WriteFile(path.Join(servicePath, "service.go"), []byte(serviceContent), 0o644); err != nil { 21 return err 22 } 23 24 return nil 25 }