Skip to content

Commit

Permalink
reformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Feb 3, 2019
1 parent ca238ac commit ae08e15
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
6 changes: 3 additions & 3 deletions bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ import (
_ "github.com/viant/endly/system/cloud/gcp/pubsub"
_ "github.com/viant/endly/system/cloud/gcp/storage"

_ "github.com/viant/endly/system/kubernetes/core"
_ "github.com/viant/endly/system/kubernetes/apps"
_ "github.com/viant/endly/system/kubernetes/core"

_ "github.com/viant/endly/system/daemon"
_ "github.com/viant/endly/system/docker/ssh"
Expand Down Expand Up @@ -513,12 +513,12 @@ func printServiceActions() {
if serviceID == "*" {
services := endly.Services(manager)
fmt.Printf("endly services:\n")
var ids = make([]string, 0)
var ids = make([]string, 0)
for k := range services {
ids = append(ids, k)
}
sort.Strings(ids)
for _,k := range ids{
for _, k := range ids {
fmt.Printf("%v %T\n", k, services[k])
}
return
Expand Down
2 changes: 1 addition & 1 deletion meta/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (m *Service) Lookup(serviceID, action string) (*Action, error) {
toolbox.InitStruct(request)
result.Request = request
result.RequestMeta = toolbox.GetStructMeta(request)
JSON, err := json.Marshal(request);
JSON, err := json.Marshal(request)
if err == nil {
if isEmpty := toolbox.AsString(JSON) == "{}"; isEmpty {
result.Request = result.RequestMeta.Message()
Expand Down
28 changes: 13 additions & 15 deletions util/adapter/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ type typeMeta struct {
SimpleOwnerType string
Imports string
TypeName string
Methods string
Fields string
Func string
Params string
Result string
OwnerPackage string
importPrefix string
aliasImports map[string]string
Methods string
Fields string
Func string
Params string
Result string
OwnerPackage string
importPrefix string
aliasImports map[string]string
}

type fileMeta struct {
Expand Down Expand Up @@ -212,7 +212,7 @@ func (g *Generator) Generate(source, typeName string, predicate func(receiver *t
var types = make([]string, 0)
var register = make([]string, 0)
for _, receiver := range typeInfo.Receivers() {
if ! predicate(receiver) {
if !predicate(receiver) {
continue
}
if len(receiver.ResultsFields) > 2 {
Expand All @@ -221,15 +221,14 @@ func (g *Generator) Generate(source, typeName string, predicate func(receiver *t

typeMeta := &typeMeta{
Func: receiver.Name,
importPrefix: fmt.Sprintf("vvc"),//import colision prefix
importPrefix: fmt.Sprintf("vvc"), //import colision prefix
SimpleOwnerType: typeInfo.Name,
aliasImports: make(map[string]string),
OwnerType: typeInfo.Package + "." + typeInfo.Name,
OwnerPackage: typeInfo.Package,
TypeName: typeNameProvider(typeName, receiver), // typePrefix + receiver.Name + typeSuffix,
}


if err = g.buildTypeFields(typeInfo, typeMeta, receiver); err == nil {
err = g.buildTypeMethods(typeInfo, typeMeta, receiver)
}
Expand All @@ -248,8 +247,8 @@ func (g *Generator) Generate(source, typeName string, predicate func(receiver *t
methods = append(methods, typeMeta.Methods)
types = append(types, typeText)

for k:=range typeMeta.aliasImports {
importMap[k]= fileInfo.Imports[k]
for k := range typeMeta.aliasImports {
importMap[k] = fileInfo.Imports[k]
}
if path, hasCollision := importMap[typeInfo.Package]; hasCollision {
delete(importMap, typeInfo.Package)
Expand All @@ -265,7 +264,6 @@ func (g *Generator) Generate(source, typeName string, predicate func(receiver *t
imports = append(imports, fmt.Sprintf(` %s %s`, k, v))
}


fileMeta := &fileMeta{
Imports: strings.Join(imports, "\n"),
Types: strings.Join(types, "\n"),
Expand All @@ -278,7 +276,7 @@ func (g *Generator) Generate(source, typeName string, predicate func(receiver *t

func (g *Generator) expandTemplate(templateId string, data interface{}) (string, error) {
textTemplate, ok := g.templates[templateId]
if ! ok {
if !ok {
return "", fmt.Errorf("failed to lookup template: %v", templateId)
}
tmpl, err := template.New(templateId).Parse(textTemplate)
Expand Down
3 changes: 0 additions & 3 deletions util/adapter/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import (
"testing"
)




func TestGenerator_Generate(t *testing.T) {

parentDir := toolbox.CallerDirectory(3)
Expand Down
4 changes: 1 addition & 3 deletions util/adapter/test/iface.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package test

type MyInterface interface {

Func1(param1 string, param2 int)

Func2(param1 []byte, param2 int) (error)
Func2(param1 []byte, param2 int) error

Func3(param1 []byte, param2 int) (interface{}, error)

}
2 changes: 1 addition & 1 deletion util/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ func BuildLowerCaseMapping(aMap map[string]interface{}) map[string]string {
result[strings.ToLower(k)] = k
}
return result
}
}

0 comments on commit ae08e15

Please sign in to comment.