func(dist Distribution, num int, dim int) ([][]float32, error) could be replaced with func(dist Distribution, num, dim int) ([][]float32, error)
158}
159
160// GenUint8Vec returns multiple uint8 vectors.
161func GenUint8Vec(dist Distribution, num int, dim int) ([][]float32, error) {162 generator, err := Uint8VectorGenerator(dist)
163 if err != nil {
164 return nil, err
func(dist Distribution, num int, dim int) ([][]float32, error) could be replaced with func(dist Distribution, num, dim int) ([][]float32, error)
149}
150
151// GenF32Vec returns multiple float32 vectors.
152func GenF32Vec(dist Distribution, num int, dim int) ([][]float32, error) {153 generator, err := Float32VectorGenerator(dist)
154 if err != nil {
155 return nil, err
func(num int, name string, ipAddr string) []*payload.Object_StreamLocation could be replaced with func(num int, name, ipAddr string) []*payload.Object_StreamLocation
36}
37
38// GenObjectStreamLocation generate ObjectStreamLocations payload with multiple name and ip with generated uuid.
39func GenObjectStreamLocation(num int, name string, ipAddr string) []*payload.Object_StreamLocation {40 result := make([]*payload.Object_StreamLocation, num)
41
42 for i := 0; i < num; i++ {
func(num int, name string, ipAddr string) *payload.Object_Locations could be replaced with func(num int, name, ipAddr string) *payload.Object_Locations
20)
21
22// GenObjectLocations generate ObjectLocations payload with multiple name and ip with generated uuid.
23func GenObjectLocations(num int, name string, ipAddr string) *payload.Object_Locations {24 result := &payload.Object_Locations{
25 Locations: make([]*payload.Object_Location, num),
26 }
func(t ObjectType, dist vector.Distribution, num int, dim int, cfg *payload.Insert_Config) (*payload.Insert_MultiRequest, error) could be replaced with func(t ObjectType, dist vector.Distribution, num, dim int, cfg *payload.Insert_Config) (*payload.Insert_MultiRequest, error)
27 Float
28)
29
30func GenMultiInsertReq(t ObjectType, dist vector.Distribution, num int, dim int, cfg *payload.Insert_Config) (*payload.Insert_MultiRequest, error) {31 var vecs [][]float32
32 var err error
33 switch t {
Description
If parameters of the same type lie consecutively, mention their type once at the end of the last parameter.
Unlike other languages, like C, where all parameters must be specified with types explicitly, it is not required to do so in Go. Combining the types is usually recommended for the sake of brevity.
Bad practice
func foo(a, b int, c, d int, e, f int, g int) {}
Recommended
func foo(a, b, c, d, e, f, g int) {}