generated from LinuxSuRen/.github
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d66f720
commit 854133c
Showing
7 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ run: | |
go run main.go | ||
|
||
fmt: | ||
go mod tidy | ||
go fmt ./... | ||
|
||
copy: build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cmd | ||
|
||
import "github.com/spf13/cobra" | ||
|
||
// NewRoot returns the root command of github-go | ||
func NewRoot() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "github-go", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
cmd.Println("hello") | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
module github.com/linuxsuren/github-go | ||
|
||
go 1.15 | ||
go 1.18 | ||
|
||
require github.com/spf13/cobra v1.1.1 | ||
|
||
require ( | ||
github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"os" | ||
|
||
"github.com/linuxsuren/github-go/cmd" | ||
) | ||
|
||
func main() { | ||
cmd := &cobra.Command{ | ||
Use: "github-go", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
cmd.Println("hello") | ||
}, | ||
} | ||
if err := cmd.Execute(); err != nil { | ||
panic(err) | ||
func main() { | ||
if err := cmd.NewRoot().Execute(); err != nil { | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// package pkg provides the placeholder of pkg | ||
|
||
package pkg |