Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add grpc example #1401

Merged
merged 10 commits into from
Jun 22, 2018
Merged

add grpc example #1401

merged 10 commits into from
Jun 22, 2018

Conversation

thinkerou
Copy link
Member

use grpc helloworld example.


// Set up a http setver.
r := gin.Default()
r.GET("/rest/n/:name", func(g *gin.Context) {
Copy link
Member

Choose a reason for hiding this comment

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

maybe change g *gin.Context to c *gin.Context.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, thanks.

"path": "google.golang.org/grpc",
"revision": "9cb02b885b41e0db982e23d6e51a24ea465dec2e",
"revisionTime": "2017-06-26T23:20:44Z"
},
Copy link
Member

Choose a reason for hiding this comment

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

Please don't update the vendor source code from example code.

Copy link
Member Author

Choose a reason for hiding this comment

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

got it, but if have not this, ci will fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

and I have removed it.

@appleboy appleboy self-assigned this Jun 21, 2018
@appleboy appleboy self-requested a review June 21, 2018 15:11
@thinkerou
Copy link
Member Author

examples/grpc/pb/helloworld.pb.go:23:2: cannot find package "google.golang.org/grpc" in any of:
	/home/travis/gopath/src/github.com/gin-gonic/gin/vendor/google.golang.org/grpc (vendor tree)
	/home/travis/.gimme/versions/go1.6.4.linux.amd64/src/google.golang.org/grpc (from $GOROOT)
	/home/travis/gopath/src/google.golang.org/grpc (from $GOPATH)
make: *** [test] Error 1

@appleboy
Copy link
Member

@thinkerou ignore check examples folder for go vet command. Done, see the latest commit.

c.JSON(http.StatusOK, gin.H{
"result": fmt.Sprint(res.Message),
})
}
Copy link
Member

Choose a reason for hiding this comment

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

maybe updated as the following for readable.

		if err != nil {
			c.JSON(http.StatusInternalServerError, gin.H{
				"error": err.Error(),
			})
			return
		}
		
		c.JSON(http.StatusOK, gin.H{
			"result": fmt.Sprint(res.Message),
		})

@codecov
Copy link

codecov bot commented Jun 22, 2018

Codecov Report

Merging #1401 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1401   +/-   ##
=======================================
  Coverage   97.99%   97.99%           
=======================================
  Files          36       36           
  Lines        1848     1848           
=======================================
  Hits         1811     1811           
  Misses         30       30           
  Partials        7        7

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf85b32...368c63c. Read the comment docs.

if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"error": err.Error(),
})
Copy link
Member

Choose a reason for hiding this comment

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

missing return.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, thanks a lot, fixed.

@thinkerou
Copy link
Member Author

thinkerou commented Jun 22, 2018

@appleboy thank you update Makefile, but I remember vendor.json have some packages from example folder, for example favicon package.

@appleboy
Copy link
Member

@thinkerou Can you also help to remove packages from example?

@thinkerou
Copy link
Member Author

@appleboy OK, I will alone commit one pull request for coding review.

@thinkerou
Copy link
Member Author

code indent error, fixed.

@appleboy appleboy merged commit 737d2fb into gin-gonic:master Jun 22, 2018
@thinkerou thinkerou deleted the pb branch June 22, 2018 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants