add travis/goreport/golint/govet

This commit is contained in:
John
2018-12-17 13:02:18 +08:00
parent 2dbc817132
commit 95db811943
20 changed files with 36 additions and 32 deletions

15
.travis.yml Normal file
View File

@ -0,0 +1,15 @@
language: go
go:
- "1.10.x"
- "1.11.x"
branches:
only:
- master
script:
- cd g && go test -v ./...

View File

@ -2,6 +2,8 @@
<img src="https://gfer.me/cover.png" width="150"/>
</div>
# GoFrame [![Build Status](https://travis-ci.org/johng-cn/gf.svg?branch=master)](https://travis-ci.org/johng-cn/gf) [![GoDoc](https://godoc.org/github.com/johng-cn/gf?status.svg)](https://godoc.org/github.com/johng-cn/gf) [![Go Report Card](https://goreportcard.com/badge/github.com/johng-cn/gf)](https://goreportcard.com/report/github.com/johng-cn/gf)
`GF(GoFrame)` is a modular, lightweight, loosely coupled, high performance application development framework written in Go. Supporting graceful server, hot updates, multi-domain, multi-port, multi-service, HTTP/HTTPS, dynamic/hook routing and many more features. Providing a series of core components and dozens of practical modules.
# Installation

View File

@ -1,11 +1,11 @@
package gdes
package gdes_test
import (
"testing"
"bytes"
"encoding/hex"
"fmt"
"gitee.com/johng/gf/g/encoding/gdes"
"gitee.com/johng/gf/g/crypto/gdes"
)
func TestDesECB(t *testing.T){

View File

@ -9,11 +9,10 @@ package gkafka
import (
"gitee.com/johng/gf/g/os/glog"
"time"
"strings"
"gitee.com/johng/gf/third/github.com/Shopify/sarama"
"gitee.com/johng/gf/third/github.com/johng-cn/sarama-cluster"
"errors"
"strings"
"time"
)
var (
@ -177,8 +176,6 @@ func (client *Client) Receive() (*Message, error) {
case <-notifyChan:
}
}
return nil, errors.New("unknown error")
}
// Send data to kafka in synchronized way.

View File

@ -487,7 +487,6 @@ func (j *Json) convertValue(value interface{}) interface{} {
v, _ := Decode(b)
return v
}
return value
}
// 用于Set方法中对指针指向的内存地址进行赋值

View File

@ -23,12 +23,12 @@ func Server(name...interface{}) *ghttp.Server {
}
// TCPServer单例对象
func TcpServer(name...interface{}) *gtcp.Server {
func TCPServer(name...interface{}) *gtcp.Server {
return gtcp.GetServer(name...)
}
// UDPServer单例对象
func UdpServer(name...interface{}) *gudp.Server {
func UDPServer(name...interface{}) *gudp.Server {
return gudp.GetServer(name...)
}

View File

@ -293,7 +293,6 @@ func (s *Server) patternToRegRule(rule string) (regrule string, names []string)
regrule += `/[^/]+`
break
}
fallthrough
case '*':
if len(v) > 1 {
regrule += `/{0,1}(.*)`
@ -303,7 +302,6 @@ func (s *Server) patternToRegRule(rule string) (regrule string, names []string)
regrule += `/{0,1}.*`
break
}
fallthrough
default:
// 特殊字符替换
v = gstr.ReplaceByMap(v, map[string]string{

View File

@ -25,7 +25,6 @@ func (s *Server)BindHookHandler(pattern string, hook string, handler HandlerFunc
fname : "",
faddr : handler,
}, hook)
return nil
}
// 通过map批量绑定回调函数

View File

@ -82,5 +82,4 @@ func (s *Server) Run() error {
go s.handler(NewConnByNetConn(conn))
}
}
return nil
}

View File

@ -85,7 +85,6 @@ func (c *Conn) Send(data []byte, retry...Retry) error {
}
}
}
return nil
}
// 接收数据

View File

@ -77,5 +77,4 @@ func (s *Server) Run() error {
for {
s.handler(NewConnByNetConn(conn))
}
return nil
}

View File

@ -105,8 +105,6 @@ func GetNextCharOffsetByPath(path string, char byte, start int64) int64 {
if f, err := OpenWithFlagPerm(path, os.O_RDONLY, gDEFAULT_PERM); err == nil {
defer f.Close()
return GetNextCharOffset(f, char, start)
} else {
panic(err)
}
return -1
}
@ -124,8 +122,6 @@ func GetBinContentsTilCharByPath(path string, char byte, start int64) ([]byte, i
if f, err := OpenWithFlagPerm(path, os.O_RDONLY, gDEFAULT_PERM); err == nil {
defer f.Close()
return GetBinContentsTilChar(f, char, start)
} else {
panic(err)
}
return nil, -1
}
@ -144,8 +140,6 @@ func GetBinContentsByTwoOffsetsByPath(path string, start int64, end int64) []byt
if f, err := OpenWithFlagPerm(path, os.O_RDONLY, gDEFAULT_PERM); err == nil {
defer f.Close()
return GetBinContentsByTwoOffsets(f, start, end)
} else {
panic(err)
}
return nil
}

View File

@ -9,6 +9,7 @@ package gfsnotify
import (
"fmt"
"gitee.com/johng/gf/g/container/glist"
"os"
)
// 监听循环
@ -33,7 +34,7 @@ func (w *Watcher) startWatchLoop() {
}, REPEAT_EVENT_FILTER_INTERVAL)
case err := <- w.watcher.Errors:
fmt.Errorf("error: %s\n" + err.Error());
fmt.Fprintf(os.Stderr, "error: %s\n" + err.Error())
}
}
}()

View File

@ -121,7 +121,6 @@ func getShell() string {
}
return path
}
return ""
}
// 获取当前系统默认shell执行指令的option参数
@ -132,7 +131,6 @@ func getShellOption() string {
default:
return "-c"
}
return ""
}
// 从环境变量PATH中搜索可执行文件

View File

@ -62,7 +62,10 @@ func startTcpListening() {
// TCP数据通信处理回调函数
func tcpServiceHandler(conn *gtcp.Conn) {
var retry = gtcp.Retry{3, 10}
retry := gtcp.Retry {
Count : 3,
Interval: 10,
}
for {
var result []byte
buffer, err := conn.Recv(-1, retry)

View File

@ -123,7 +123,7 @@ func (t *Time) ToZone(zone string) *Time {
t.Time = t.Time.In(l)
return t
} else {
panic(err)
//panic(err)
return nil
}
}

View File

@ -11,6 +11,7 @@ import (
"fmt"
"bytes"
"encoding/json"
"os"
"reflect"
"gitee.com/johng/gf/g/util/gconv"
"runtime"
@ -43,7 +44,7 @@ func Dump(i...interface{}) {
if err := encoder.Encode(v); err == nil {
fmt.Print(buffer.String())
} else {
fmt.Errorf("%s", err.Error())
fmt.Fprintln(os.Stderr, err.Error())
}
}
//fmt.Println()

View File

@ -5,6 +5,7 @@ import (
"bytes"
"gitee.com/johng/gf/g/net/gtcp"
"gitee.com/johng/gf/g/util/gconv"
"os"
)
func main() {
@ -39,7 +40,7 @@ func main() {
break
}
if err != nil {
fmt.Errorf("ERROR: %s\n", err.Error())
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err.Error())
break
}
}

View File

@ -3,6 +3,7 @@ package main
import (
"gitee.com/johng/gf/g/net/gtcp"
"fmt"
"os"
)
func main() {
@ -11,6 +12,6 @@ func main() {
fmt.Println(string(data))
}
if err != nil {
fmt.Errorf("ERROR: %s\n", err.Error())
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err.Error())
}
}

View File

@ -272,6 +272,4 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in
}
return yamlObj, nil
}
return nil, nil
}