S
S
serp in2016-02-16 19:24:45
go
serp in, 2016-02-16 19:24:45

Creating an unused variable, why?

https://github.com/gin-gonic/gin/blob/master/route...
In modules to call init, what's the point of this case?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
redakoc, 2016-02-17
@abacabb

Initializations (not this case),
Remains from debugging,
Type checks (we force the compiler to check everything for us).
In this case, the third one.
var _ IRouter = &RouterGroup{}
Verify that the RouterGroup structure implements the IRouter interface.
This is part of the code to test.
True, this is not a separate active test, those that are written in *_test.go files.
But we force additional checks to be carried out at the compilation stage.

N
Nikita, 2016-02-16
@bitver

Probably so that the static analyzer does not swear that the types are declared and not used.

E
Evgeny Popov, 2014-10-30
@mihaevs

For example jsfiddle.net/ayL7b1tv

S
Satellence, 2014-10-30
@Satellence

Under the day and month, allocate a separate block of fixed width with text alignment to the right for the number and to the left for the month.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question