-
Notifications
You must be signed in to change notification settings - Fork 923
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #691 from beego/develop
support go mod and bee pro gen
- Loading branch information
Showing
38 changed files
with
2,276 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
language: go | ||
go: | ||
- 1.10.3 | ||
- 1.12.17 | ||
install: | ||
- export PATH=$PATH:$HOME/gopath/bin | ||
- go get -u github.com/opennota/check/cmd/structcheck | ||
- go get -u honnef.co/go/tools/cmd/gosimple | ||
- go get -u honnef.co/go/tools/cmd/staticcheck | ||
- go get -u honnef.co/go/tools/cmd/unused | ||
- go get -u github.com/mdempsky/unconvert | ||
- go get -u github.com/gordonklaus/ineffassign | ||
script: | ||
- pwd | ||
- cd $(dirname `dirname $(pwd)`)/beego/bee | ||
- export GO111MODULE="on" | ||
- go mod download | ||
- find . ! \( -path './vendor' -prune \) -type f -name '*.go' -print0 | xargs -0 gofmt -l -s | ||
- go vet $(go list ./... | grep -v /vendor/) | ||
- structcheck $(go list ./... | grep -v /vendor/) | ||
- gosimple -ignore "$(cat gosimple.ignore)" $(go list ./... | grep -v /vendor/) | ||
- staticcheck -ignore "$(cat staticcheck.ignore)" $(go list ./... | grep -v /vendor/) | ||
- unused $(go list ./... | grep -v /vendor/) | ||
- unconvert $(go list ./... | grep -v /vendor/) | ||
- go list ./... | grep -v /vendor/ | grep -v /pkg/mod/ | ||
- go vet $(go list ./... | grep -v /vendor/ | grep -v /pkg/mod/ ) | ||
- structcheck $(go list ./... | grep -v /vendor/ | grep -v /pkg/mod/ ) | ||
- staticcheck $(go list ./... | grep -v /vendor/ | grep -v /pkg/mod/ ) | ||
- unconvert $(go list ./... | grep -v /vendor/ | grep -v /pkg/mod/ ) | ||
- ineffassign . |
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2013 bee authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"): you may | ||
// not use this file except in compliance with the License. You may obtain | ||
// a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
// License for the specific language governing permissions and limitations | ||
// under the License. | ||
package beegopro | ||
|
||
import ( | ||
"github.com/beego/bee/cmd/commands" | ||
"github.com/beego/bee/internal/app/module/beegopro" | ||
"github.com/beego/bee/logger" | ||
"strings" | ||
) | ||
|
||
var CmdBeegoPro = &commands.Command{ | ||
UsageLine: "pro [command]", | ||
Short: "Source code generator", | ||
Long: ``, | ||
Run: BeegoPro, | ||
} | ||
|
||
func init() { | ||
CmdBeegoPro.Flag.Var(&beegopro.SQL, "sql", "sql file path") | ||
CmdBeegoPro.Flag.Var(&beegopro.SQLMode, "sqlmode", "sql mode") | ||
CmdBeegoPro.Flag.Var(&beegopro.SQLModePath, "sqlpath", "sql mode path") | ||
commands.AvailableCommands = append(commands.AvailableCommands, CmdBeegoPro) | ||
} | ||
|
||
func BeegoPro(cmd *commands.Command, args []string) int { | ||
if len(args) < 1 { | ||
beeLogger.Log.Fatal("Command is missing") | ||
} | ||
|
||
if len(args) >= 2 { | ||
cmd.Flag.Parse(args[1:]) | ||
} | ||
|
||
gcmd := args[0] | ||
switch gcmd { | ||
case "gen": | ||
beegopro.DefaultBeegoPro.Run() | ||
case "config": | ||
beegopro.DefaultBeegoPro.GenConfig() | ||
case "migration": | ||
beegopro.DefaultBeegoPro.Migration(args) | ||
default: | ||
beeLogger.Log.Fatal("Command is missing") | ||
} | ||
beeLogger.Log.Successf("%s successfully generated!", strings.Title(gcmd)) | ||
return 0 | ||
} |
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
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
Oops, something went wrong.