2

I'm afraid I don't think it is useful. But code like this from google must have it's reason.

var _ db.DB = (*DB)(nil)

It is from package code.google.com/p/leveldb-go.

Please tell me the purpose of this.

9000
  • 39,899
  • 9
  • 66
  • 104
hardPass
  • 19,033
  • 19
  • 40
  • 42
  • @DarshanComputing: thanks! It should be noted that `db.DB` and `DB` are different interfaces, despite confusingly similar names. – 9000 May 08 '13 at 05:09
  • 1
    I see. The answers from linked page explain it quite well. It is a really handy way to ensure or check `*DB` is implemet to `db.DB`. – hardPass May 08 '13 at 05:36

0 Answers0