Skip to content

Commit

Permalink
feat: touble suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Bin-Huang committed Aug 11, 2022
1 parent 7c1f755 commit 182cc00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ See [more examples here](https://github.com/Bin-Huang/make-constructor/tree/mast
Without manual installation, just add this comment line to the struct. Go will automatically install this tool if missing.

```go
//go:generate go run github.com/Bin-Huang/[email protected].3
//go:generate go run github.com/Bin-Huang/[email protected].4
```

For example:

```go
//go:generate go run github.com/Bin-Huang/[email protected].3
//go:generate go run github.com/Bin-Huang/[email protected].4
type UserService struct {
baseService
userRepository *repositories.UserRepository
Expand Down Expand Up @@ -129,7 +129,7 @@ Don't worry about the imports, variable naming, and code style in the generated
It doesn't break the work of other people who don't have installed this tool in collaboration. Go will automatically install this tool if missing.

```go
//go:generate go run github.com/Bin-Huang/[email protected].3
//go:generate go run github.com/Bin-Huang/[email protected].4
```

## Sponsoring
Expand Down
6 changes: 3 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ func NewUserService(baseService baseService, userRepository *repositories.UserRe
无需手动安装,只需要给结构体添加下面这行注释就行。Go 会在缺失时自动下载这个工具。

```go
//go:generate go run github.com/Bin-Huang/[email protected].3
//go:generate go run github.com/Bin-Huang/[email protected].4
```

比如这样:

```go
//go:generate go run github.com/Bin-Huang/[email protected].3
//go:generate go run github.com/Bin-Huang/[email protected].4
type UserService struct {
baseService
userRepository *repositories.UserRepository
Expand Down Expand Up @@ -129,7 +129,7 @@ func NewController(logger *zap.Logger, debug bool) *Controller {
就算其他同事没有安装这个工具,这么做也不会影响到他们的工作。因为 Go 会在必要时自动安装这个工具。

```go
//go:generate go run github.com/Bin-Huang/[email protected].3
//go:generate go run github.com/Bin-Huang/[email protected].4
```

## 赞赏
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ func main() {
err := makeConstructor()
if err != nil {
fmt.Printf("make-constructor: [ERROR] %v\n", err)
fmt.Printf("It seems like there is some trouble here. Try this:\n")
fmt.Printf("\t1. Check and upgrade this tool (https://github.com/Bin-Huang/make-constructor)\n")
fmt.Printf("\t2. Submit an issue on Github (https://github.com/Bin-Huang/make-constructor/issues)\n")
os.Exit(1)
}
}
Expand Down

0 comments on commit 182cc00

Please sign in to comment.