Skip to content

Commit

Permalink
fix goreport for gofmt (#2523)
Browse files Browse the repository at this point in the history
  • Loading branch information
hailaz authored Mar 17, 2023
1 parent 4a278df commit 5083174
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 76 deletions.
35 changes: 14 additions & 21 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# GoFrame

<div align=center>
<img src="https://goframe.org/statics/image/gf-head-large.png" width="100"/>

[![Go Doc](https://godoc.org/github.com/gogf/gf?status.svg)](https://godoc.org/github.com/gogf/gf)
[![GoFrame CI](https://github.com/gogf/gf/actions/workflows/gf.yml/badge.svg)](https://github.com/gogf/gf/actions/workflows/gf.yml)
[![Go Report](https://goreportcard.com/badge/github.com/gogf/gf?v=1)](https://goreportcard.com/report/github.com/gogf/gf)
[![Go Report Card](https://goreportcard.com/badge/github.com/gogf/gf/v2)](https://goreportcard.com/report/github.com/gogf/gf/v2)
[![Code Coverage](https://codecov.io/gh/gogf/gf/branch/master/graph/badge.svg)](https://codecov.io/gh/gogf/gf)
[![Production Ready](https://img.shields.io/badge/production-ready-blue.svg)](https://github.com/gogf/gf)
[![License](https://img.shields.io/github/license/gogf/gf.svg?style=flat)](https://github.com/gogf/gf)
</div>

`GoFrame` is a modular, powerful, high-performance and enterprise-class application development framework of Golang.
`GoFrame` is a modular, powerful, high-performance and enterprise-class application development framework of Golang.

# Features

- modular, loosely coupled design
- rich components, out-of-the-box
- automatic codes generating for efficiency
Expand All @@ -27,34 +29,37 @@
- much, much more...ready to explore?

# Installation

Enter your repo. directory and execute following command:

## primary module

```bash
go get -u -v github.com/gogf/gf/v2
```

## cli tool

```bash
go install github.com/gogf/gf/cmd/gf/v2
```

# Limitation

```
golang version >= 1.15
```

# Architecture

<div align=center>
<img src="https://goframe.org/download/attachments/1114119/arch.png"/>
</div>


# Documentation

* Chinese Official Site(中文官网): [https://goframe.org](https://goframe.org/display/gf)
* GoDoc API: [https://pkg.go.dev/github.com/gogf/gf/v2](https://pkg.go.dev/github.com/gogf/gf/v2)

- Chinese Official Site(中文官网): [https://goframe.org](https://goframe.org/display/gf)
- GoDoc API: [https://pkg.go.dev/github.com/gogf/gf/v2](https://pkg.go.dev/github.com/gogf/gf/v2)

# License

Expand All @@ -76,32 +81,20 @@ golang version >= 1.15

> We list part of the users here, if your company or products are using `GoFrame`, please let us know [here](https://goframe.org/pages/viewpage.action?pageId=1114415).

# Contributors

This project exists thanks to all the people who contribute. [[Contributors](https://github.com/gogf/gf/graphs/contributors)].
<a href="https://github.com/gogf/gf/graphs/contributors"><img src="https://contributors-img.web.app/image?repo=gogf/gf" /></a>


# Donators

If you love `GoFrame`, why not [buy developer a cup of coffee](https://goframe.org/pages/viewpage.action?pageId=1115633)?

# Sponsors
We appreciate any kind of sponsorship for `GoFrame` development. If you've got some interesting, please contact WeChat `389961817` / Email `john@goframe.org`.


We appreciate any kind of sponsorship for `GoFrame` development. If you've got some interesting, please contact WeChat `389961817` / Email `john@goframe.org`.

# Thanks

<a href="https://www.jetbrains.com/?from=GoFrame"><img src="https://goframe.org/download/thumbnails/1114119/jetbrains.png" height="120" alt="JetBrains"/></a>
<a href="https://www.atlassian.com/?from=GoFrame"><img src="https://goframe.org/download/attachments/1114119/atlassian.jpg" height="120" alt="Atlassian"/></a>











2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/cmd_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (c cBuild) Index(ctx context.Context, in cBuildInput) (out *cBuildOutput, e
if len(customSystems) > 0 && customSystems[0] != "all" && !gstr.InArray(customSystems, system) {
continue
}
for arch, _ := range item {
for arch := range item {
if len(customArches) > 0 && customArches[0] != "all" && !gstr.InArray(customArches, arch) {
continue
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/gf/internal/cmd/genservice/genservice_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c CGenService) generateServiceFile(in generateServiceFilesInput) (ok bool,
generatingInterfaceCheck string
)
// Variable definitions.
for structName, _ := range in.SrcStructFunctions {
for structName := range in.SrcStructFunctions {
generatingInterfaceCheck = fmt.Sprintf(`[^\w\d]+%s.I%s[^\w\d]`, in.DstPackageName, structName)
if gregex.IsMatchString(generatingInterfaceCheck, generatedContent) {
continue
Expand All @@ -75,7 +75,7 @@ func (c CGenService) generateServiceFile(in generateServiceFilesInput) (ok bool,
generatedContent += "\n"
}
// Variable register function definitions.
for structName, _ := range in.SrcStructFunctions {
for structName := range in.SrcStructFunctions {
generatingInterfaceCheck = fmt.Sprintf(`[^\w\d]+%s.I%s[^\w\d]`, in.DstPackageName, structName)
if gregex.IsMatchString(generatingInterfaceCheck, generatedContent) {
continue
Expand Down
4 changes: 2 additions & 2 deletions container/gset/gset_z_unit_any_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func TestSet_LockFunc(t *testing.T) {
t.Assert(s.Size(), 2)
s.RLockFunc(func(m map[interface{}]struct{}) {
t.Assert(m, map[interface{}]struct{}{
3: struct{}{},
2: struct{}{},
3: {},
2: {},
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions container/gset/gset_z_unit_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func TestIntSet_LockFunc(t *testing.T) {
t.Assert(s.Size(), 2)
s.RLockFunc(func(m map[int]struct{}) {
t.Assert(m, map[int]struct{}{
3: struct{}{},
2: struct{}{},
3: {},
2: {},
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions container/gset/gset_z_unit_str_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func TestStrSet_LockFunc(t *testing.T) {
t.Assert(s.Size(), 2)
s.RLockFunc(func(m map[string]struct{}) {
t.Assert(m, map[string]struct{}{
"3": struct{}{},
"2": struct{}{},
"3": {},
"2": {},
})
})
})
Expand Down
12 changes: 6 additions & 6 deletions contrib/drivers/clickhouse/clickhouse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,9 @@ func TestDriverClickhouse_NilTime(t *testing.T) {
Col9: uuid.New(),
Col7: []interface{}{ // Tuple(String, UInt8, Array(Map(String, String)))
"String Value", uint8(5), []map[string]string{
map[string]string{"key": "value"},
map[string]string{"key": "value"},
map[string]string{"key": "value"},
{"key": "value"},
{"key": "value"},
{"key": "value"},
}},
Col11: money,
Col12: &strMoney,
Expand Down Expand Up @@ -494,9 +494,9 @@ func TestDriverClickhouse_BatchInsert(t *testing.T) {
"Col6": []string{"Q", "W", "E", "R", "T", "Y"}, // Array(String)
"Col7": []interface{}{ // Tuple(String, UInt8, Array(Map(String, String)))
"String Value", uint8(5), []map[string]string{
map[string]string{"key": "value"},
map[string]string{"key": "value"},
map[string]string{"key": "value"},
{"key": "value"},
{"key": "value"},
{"key": "value"},
},
},
"Col8": gtime.Now(),
Expand Down
8 changes: 4 additions & 4 deletions contrib/nosql/redis/redis_group_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ func (r GroupList) LPop(ctx context.Context, key string, count ...int) (*gvar.Va
// depending on the list's length.
//
// It returns:
// - When called without the count argument:
// the value of the last element, or nil when key does not exist.
// - When called with the count argument:
// list of popped elements, or nil when key does not exist.
// - When called without the count argument:
// the value of the last element, or nil when key does not exist.
// - When called with the count argument:
// list of popped elements, or nil when key does not exist.
//
// https://redis.io/commands/rpop
func (r GroupList) RPop(ctx context.Context, key string, count ...int) (*gvar.Var, error) {
Expand Down
18 changes: 9 additions & 9 deletions contrib/nosql/redis/redis_group_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ func (r GroupSet) SIsMember(ctx context.Context, key string, member interface{})
// argument, the reply will consist of up to count members, depending on the set's cardinality.
//
// It returns:
// - When called without the count argument:
// Bulk string reply: the removed member, or nil when key does not exist.
// - When called with the count argument:
// Array reply: the removed members, or an empty array when key does not exist.
// - When called without the count argument:
// Bulk string reply: the removed member, or nil when key does not exist.
// - When called with the count argument:
// Array reply: the removed members, or an empty array when key does not exist.
//
// https://redis.io/commands/spop/
func (r GroupSet) SPop(ctx context.Context, key string, count ...int) (*gvar.Var, error) {
Expand All @@ -86,10 +86,10 @@ func (r GroupSet) SPop(ctx context.Context, key string, count ...int) (*gvar.Var
// of the specified count.
//
// It returns:
// - Bulk string reply: without the additional count argument, the command returns a Bulk Reply with the
// randomly selected element, or nil when key does not exist.
// - Array reply: when the additional count argument is passed, the command returns an array of elements,
// or an empty array when key does not exist.
// - Bulk string reply: without the additional count argument, the command returns a Bulk Reply with the
// randomly selected element, or nil when key does not exist.
// - Array reply: when the additional count argument is passed, the command returns an array of elements,
// or an empty array when key does not exist.
//
// https://redis.io/commands/srandmember/
func (r GroupSet) SRandMember(ctx context.Context, key string, count ...int) (*gvar.Var, error) {
Expand Down Expand Up @@ -212,7 +212,7 @@ func (r GroupSet) SUnion(ctx context.Context, key string, keys ...string) (gvar.

// SUnionStore is equal to SUnion, but instead of returning the resulting set, it is stored in destination.
//
// If destination already exists, it is overwritten.
// If destination already exists, it is overwritten.
//
// It returns the number of elements in the resulting set.
//
Expand Down
4 changes: 2 additions & 2 deletions contrib/nosql/redis/redis_group_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func (r GroupString) SetNX(ctx context.Context, key string, value interface{}) (
// SetEX sets key to hold the string value and set key to timeout after a given number of seconds.
// This command is equivalent to executing the following commands:
//
// SET myKey value
// EXPIRE myKey seconds
// SET myKey value
// EXPIRE myKey seconds
//
// SetEX is atomic, and can be reproduced by using the previous two commands inside an MULTI / EXEC block.
// It is provided as a faster alternative to the given sequence of operations, because this operation is very
Expand Down
4 changes: 2 additions & 2 deletions encoding/gjson/gjson_z_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,11 @@ func ExampleJson_Interfaces() {
}

infoList := []BaseInfo{
BaseInfo{
{
Name: "John",
Age: 18,
},
BaseInfo{
{
Name: "Tom",
Age: 20,
},
Expand Down
24 changes: 12 additions & 12 deletions internal/deepcopy/deepcopy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ Interfaces:

// not meant to be exhaustive
func TestComplexSlices(t *testing.T) {
orig3Int := [][][]int{[][]int{[]int{1, 2, 3}, []int{11, 22, 33}}, [][]int{[]int{7, 8, 9}, []int{66, 77, 88, 99}}}
orig3Int := [][][]int{{{1, 2, 3}, {11, 22, 33}}, {{7, 8, 9}, {66, 77, 88, 99}}}
cpyI := Copy(orig3Int).([][][]int)
if (*reflect.SliceHeader)(unsafe.Pointer(&orig3Int)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyI)).Data {
t.Error("[][][]int: address of copy was the same as original; they should be different")
Expand Down Expand Up @@ -606,7 +606,7 @@ func TestComplexSlices(t *testing.T) {
}

sliceMap:
slMap := []map[int]string{map[int]string{0: "a", 1: "b"}, map[int]string{10: "k", 11: "l", 12: "m"}}
slMap := []map[int]string{{0: "a", 1: "b"}, {10: "k", 11: "l", 12: "m"}}
cpyM := Copy(slMap).([]map[int]string)
if (*reflect.SliceHeader)(unsafe.Pointer(&slMap)).Data == (*reflect.SliceHeader)(unsafe.Pointer(&cpyM)).Data {
t.Error("[]map[int]string: address of copy was the same as original; they should be different")
Expand Down Expand Up @@ -656,11 +656,11 @@ var AStruct = A{
UintSl: []uint{0, 1, 2, 3},
Map: map[string]int{"a": 1, "b": 2},
MapB: map[string]*B{
"hi": &B{Vals: []string{"hello", "bonjour"}},
"bye": &B{Vals: []string{"good-bye", "au revoir"}},
"hi": {Vals: []string{"hello", "bonjour"}},
"bye": {Vals: []string{"good-bye", "au revoir"}},
},
SliceB: []B{
B{Vals: []string{"Ciao", "Aloha"}},
{Vals: []string{"Ciao", "Aloha"}},
},
B: B{Vals: []string{"42"}},
T: time.Now(),
Expand Down Expand Up @@ -943,13 +943,13 @@ func TestIssue9(t *testing.T) {

testB := Biz{
Epsilon: map[int]*Bar{
0: &Bar{},
1: &Bar{
0: {},
1: {
Beta: "don't panic",
Gamma: 42,
Delta: nil,
},
2: &Bar{
2: {
Beta: "sudo make me a sandwich.",
Gamma: 11,
Delta: &Foo{
Expand Down Expand Up @@ -1005,10 +1005,10 @@ func TestIssue9(t *testing.T) {

// test that map keys are deep copied
testC := map[*Foo][]string{
&Foo{Alpha: "Henry Dorsett Case"}: []string{
{Alpha: "Henry Dorsett Case"}: {
"Cutter",
},
&Foo{Alpha: "Molly Millions"}: []string{
{Alpha: "Molly Millions"}: {
"Rose Kolodny",
"Cat Mother",
"Steppin' Razor",
Expand Down Expand Up @@ -1051,8 +1051,8 @@ func TestIssue9(t *testing.T) {
}

testD := map[Bizz]string{
Bizz{&Foo{"Neuromancer"}}: "Rio",
Bizz{&Foo{"Wintermute"}}: "Berne",
{&Foo{"Neuromancer"}}: "Rio",
{&Foo{"Wintermute"}}: "Berne",
}
copyD := Copy(testD).(map[Bizz]string)
if len(copyD) != len(testD) {
Expand Down
4 changes: 2 additions & 2 deletions net/gtcp/gtcp_z_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func startTCPTLSServer(addr string) *gtcp.Server {
tlsConfig := &tls.Config{
InsecureSkipVerify: true,
Certificates: []tls.Certificate{
tls.Certificate{},
{},
},
}
s := gtcp.NewServerTLS(addr, tlsConfig, func(conn *gtcp.Conn) {
Expand Down Expand Up @@ -171,7 +171,7 @@ func TestNewConnTLS(t *testing.T) {
conn, err := gtcp.NewConnTLS(s.GetListenedAddress(), &tls.Config{
InsecureSkipVerify: true,
Certificates: []tls.Certificate{
tls.Certificate{},
{},
},
})
t.AssertNil(conn)
Expand Down
4 changes: 2 additions & 2 deletions os/gcron/gcron_z_unit_schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func TestSlash(t *testing.T) {
spec string
expected map[int]struct{}
}{
{"0 0 0 * Feb Mon/2", map[int]struct{}{1: struct{}{}, 3: struct{}{}, 5: struct{}{}}},
{"0 0 0 * Feb *", map[int]struct{}{1: struct{}{}, 2: struct{}{}, 3: struct{}{}, 4: struct{}{}, 5: struct{}{}, 6: struct{}{}, 0: struct{}{}}},
{"0 0 0 * Feb Mon/2", map[int]struct{}{1: {}, 3: {}, 5: {}}},
{"0 0 0 * Feb *", map[int]struct{}{1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 0: {}}},
}
gtest.C(t, func(t *gtest.T) {
for _, c := range runs {
Expand Down
Loading

0 comments on commit 5083174

Please sign in to comment.