Skip to content

Conversation

@akvise
Copy link
Owner

@akvise akvise commented Aug 7, 2021

No description provided.

@@ -0,0 +1,7 @@
package User

type Struct struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange name of struct

Token string `json:"token"`
CurrentDate string `json:"current_date"`
ExpireAt string `json:"expire_at"`
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't expose this struct in separate package. If you want using structure like this, you should make it in all your services.

@@ -0,0 +1,46 @@
package main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't add compiled files to git. (remove compiled files)

func PostToStore(token string, name string, address string) {
curUser := User.Struct{Token: token, CurrentDate: time.Now().String(),
ExpireAt: time.Now().AddDate(0, 0, 10).String()}
mapUser := map[string]User.Struct{name + " " + address: curUser}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need use map there - you can marshal your user struct and add it in request body

}

var res map[string]User.Struct
json.NewDecoder(r.Body).Decode(&res)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unmarshal body in user struct directly. Then add it to map

"../User"
)

var Users []map[string]User.Struct
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need array of maps. You need only one to save your user tokens

@@ -0,0 +1,3 @@
FROM scratch
ADD main /
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automate building application in docker.

@@ -0,0 +1,3 @@
FROM scratch
ADD main /
CMD ["/main"] No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automate building application in docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants