I'm frustrated with the Pubnub Go API because it does not follow the guidelines common to all Go libraries. Would it be possible to fix the library to act more like a normal Go library?
While not an exhaustive list, the following issues violate the Go coding guidelines.
Package Name:
"By convention, packages are given lower case, single-word names; there should be no need for underscores or mixedCaps." http://golang.org/doc/effective_go.html#package-names
pubnubMessaging violates this idiom. Naming the package pubnub would be great. Even putting it in pubnub/messaging with the package name messaging would be better than what is currently here.
PubNubInit()
In idomatic Go, a constructor-like function should be called New() or NewXXX(), depending on whether there is more than one constructor per package.
Calling pubnubMessaging.PubnubInit() is not idiomatic Go code. pubnub.New() is. Using Init() is actually more confusing, as it is also idiomatic to call New().Init(), but never just Init().
Variable/Constant Names
In go, public variables begin with an uppercase letter, and private variables begin with a lowercase letter. Variables should not begin with an underscore. Typically, the naming convention for constants is that they always begin with an uppercase letter.
I'm frustrated with the Pubnub Go API because it does not follow the guidelines common to all Go libraries. Would it be possible to fix the library to act more like a normal Go library?
While not an exhaustive list, the following issues violate the Go coding guidelines.
Package Name:
"By convention, packages are given lower case, single-word names; there should be no need for underscores or mixedCaps." http://golang.org/doc/effective_go.html#package-names
pubnubMessaging violates this idiom. Naming the package
pubnubwould be great. Even putting it inpubnub/messagingwith the package namemessagingwould be better than what is currently here.PubNubInit()
In idomatic Go, a constructor-like function should be called
New()orNewXXX(), depending on whether there is more than one constructor per package.Calling
pubnubMessaging.PubnubInit()is not idiomatic Go code.pubnub.New()is. Using Init() is actually more confusing, as it is also idiomatic to call New().Init(), but never just Init().Variable/Constant Names
In go, public variables begin with an uppercase letter, and private variables begin with a lowercase letter. Variables should not begin with an underscore. Typically, the naming convention for constants is that they always begin with an uppercase letter.