Hi,
"Declaring Empty Slices" of CodeReviewComments
( https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
) says as below:
```
When declaring a slice, use
var t []string
rather than
t := []string{}
The former avoids allocating memory if the slice is never appended to.
I've been using CGO on Windows for a while it works well. I followed Andrew
Gerrand's advice here:
https://groups.google.com/forum/#!topic/golang-dev/Rjgft0z8ICo
I installed TDM-GCC, and then Go. See the discussion there.
Tim
On Tuesday, 31 January 2017 02:32:34 UTC+11, Arie van Wingerden wrot
Hi.
In a web application I need to append a path to an URL, but unfortunately
this is more complex as it should be.
I planned to use path.Join, but the trailing slash is removed from the
returned URL; as an example:
path.Join("/login/", "/a/b/") will return "/login/a/b", but it should be
"/logi
I'd advice you to use bash on Ubuntu on windows to compile cgo programs on
windows. It's easy to use and works.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to g
Nestor,
On Mon, Jan 30, 2017 at 8:05 PM, Néstor Flórez wrote:
> I am trying to learn Go and I do not understand why I am getting an error
> on line 15?
> Can someone tell me what is the problem.
>
> Thanks!!
>
> ---
> package main
>
> import "fmt"
>
> func main() {
> type say struct {
You defined say inside main, but Super is defined outside main, so say is not
in scope there. Move the definition of say outside of main, so that it is a
top-level (global) declaration.
Andy
PS Even after you do that, your program will print 9000 rather than 19000,
because Super is modifying a
I am trying to learn Go and I do not understand why I am getting an error
on line 15?
Can someone tell me what is the problem.
Thanks!!
---
package main
import "fmt"
func main() {
type say struct {
Name string
Power int
}
goku := say{"Goku", 9000}
Super(goku)
fmt.Prin
[:] still has a use for arrays.
https://play.golang.org/p/L0jfM46Zg4
On Tue, Jan 31, 2017 at 12:00 AM, Jan Mercl <0xj...@gmail.com> wrote:
> On Mon, Jan 30, 2017 at 7:44 PM Andy Balholm
> wrote:
>
> > Anyway, I can’t think of any reason to use [:] on a slice either.
>
> reasons[:]: https://play
On Mon, Jan 30, 2017 at 7:44 PM Andy Balholm wrote:
> Anyway, I can’t think of any reason to use [:] on a slice either.
reasons[:]: https://play.golang.org/p/PN9qBf13Th ;-)
--
-j
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe
Most likely they originally used an array, and changed it to a slice later.
Since that line still compiled, it didn’t get changed. Or else they are just
confused.
Anyway, I can’t think of any reason to use [:] on a slice either.
Andy
--
You received this message because you are subscribed to
Slicing is useful but is there a difference between simple slice assignment
and [:] ?
Like this:
A := []int{1, 2, 3}
b := A[:] vs. b := A
Why would I want to use A[:] if A is a slice? If A is an array I would
understand. But it is a slice.
I found this in some third party library and got puz
Hello,
When this thread came up I was working on an ini formatting tool, similar
to (but way simpler than) gofmt, which required parsing and manipulating
the contents of an ini file. As you have found out, there are a bunch of
packages already doing that, but not in the spirit of simplicity tha
Maybe! Tomorrow i'll investigate this further.
Thx!
On Jan 30, 2017 6:39 PM, "Roberto Zanotto" wrote:
> Maybe gcc.exe is the 64 version, since you installed mingw64. Have you
> tried it with cgo?
>
> On Monday, January 30, 2017 at 6:31:40 PM UTC+1, Roberto Zanotto wrote:
>>
>> That's strange. I'
The second thing you tried is usually the best way to do this in Go: define an
interface with the methods that vary by type, and then make a function with the
type-independent logic. It’s actually cleaner in many cases than the classic OO
way with overriding methods, but a direct translation fro
Maybe gcc.exe is the 64 version, since you installed mingw64. Have you
tried it with cgo?
On Monday, January 30, 2017 at 6:31:40 PM UTC+1, Roberto Zanotto wrote:
>
> That's strange. I'm 100% positive that i686-w64-mingw32 is 32bit
> and x86_64-w64-mingw32 is 64bit.
> The help message that you ar
That's strange. I'm 100% positive that i686-w64-mingw32 is 32bit
and x86_64-w64-mingw32 is 64bit.
The help message that you are citing seems to suggest that i686-w64-mingw32
can produce 64bit code with -m64 flag,
but searching for info on that flag I found this:
http://stackoverflow.com/questions
Thank you!! That worked brilliantly!
On Monday, January 30, 2017 at 10:39:56 AM UTC-5, Konstantin Khomoutov
wrote:
>
> On Mon, 30 Jan 2017 07:14:23 -0800 (PST)
> Rich > wrote:
>
> > If I have JSON that looks like this:
> [...]
> > > My question is that the JSON I have to parse the IPAddr is n
Parent struct methods get the receiver of parent, and cannot refer to child.
Try https://play.golang.org/p/fi3T_Z95O8
On Monday, January 30, 2017 at 9:31:15 PM UTC+5:30, jul.s...@gmail.com
wrote:
>
> Hi,
>
> Where I work, we are currently experimenting with golang in order to
> migrate our exis
I absolutely installed Mingw64 and there are only 2 gcc.exe files:
1. gcc.exe (seems to be 32 bit)
2. i686-w64-mingw32-gcc.exe (seems to be 64 bit)
in the help of this one it says:
-m64Generate 64bit x86-64 code.
so must be an x64 compiler ...
2017-01-30 17:45 GMT+01:00
Aha yes well if thats the only way then I guess it could work.
Would anyone object to adding some config for this to Encoder?
Thanks,
mån 30 jan. 2017 kl 17:54 skrev C Banning :
> https://play.golang.org/p/W5cQkqS0h_
>
>
> On Monday, January 30, 2017 at 9:06:49 AM UTC-7, Henrik Johansson wrote
Downside with this is it implies doing copy/pasting and maintaining
duplicate code. If PrepareAndAttack would contain complex logic other than
a simple print, that will certainly lead to an un-maintainable mess
Julien Semaan
On 30 January 2017 at 11:40, wrote:
> Parent struct methods get the re
https://play.golang.org/p/W5cQkqS0h_
On Monday, January 30, 2017 at 9:06:49 AM UTC-7, Henrik Johansson wrote:
>
> I am truly sorry for resurrecting this old thread but I found my self
> needing to emit xml containing:
>
>
>
> today and I am unsure how to deal with it.
>
> I have to do it for le
I suppose the error comes from the fact that you are using the 32bit
compiler. *i686*-w64-mingw32-gcc.exe is 32bit, try with
x86_64-w64-mingw32-gcc.exe
If CC is set correctly, cgo should use that. If you are worried that
gcc.exe is being used, temporarily move gcc.exe where cgo can't find it an
The name of the MINGW suggest that it is 32-bit - are you sure you are
running a full 64-bit tool chain?
What does the --version of the gcc output?
On Mon, Jan 30, 2017, 17:30 Arie van Wingerden wrote:
>
> 2017-01-30 12:04 GMT+01:00 Arie van Wingerden :
>
> set PATH=%GOROOT%\%MINGWPATH%\bin;%P
2017-01-30 12:04 GMT+01:00 Arie van Wingerden :
> set PATH=%GOROOT%\%MINGWPATH%\bin;%PATH%
>
typo: should be:
set PATH=%GOROOT%\bin;%MINGWPATH%;%PATH%
behavior further as described
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubs
I am truly sorry for resurrecting this old thread but I found my self
needing to emit xml containing:
today and I am unsure how to deal with it.
I have to do it for legacy reasons and there is very little leeway in what
the clients can accept.
It is also high volumes and no files are generat
https://play.golang.org/p/uvbJYQoqtl
On Mon, Jan 30, 2017 at 7:39 AM Konstantin Khomoutov <
flatw...@users.sourceforge.net> wrote:
> On Mon, 30 Jan 2017 07:14:23 -0800 (PST)
> Rich wrote:
>
> > If I have JSON that looks like this:
> [...]
> > > My question is that the JSON I have to parse the IP
Hi,
Where I work, we are currently experimenting with golang in order to
migrate our existing Perl codebase to golang.
Although Perl isn't a pure OO language, it allows for a lot of the OO
patterns to be used. One of the patterns we do use is where a superclass
method wraps a series of call to
https://play.golang.org/p/uvbJYQoqtl
On Mon, Jan 30, 2017 at 7:39 AM Konstantin Khomoutov <
flatw...@users.sourceforge.net> wrote:
> On Mon, 30 Jan 2017 07:14:23 -0800 (PST)
> Rich wrote:
>
> > If I have JSON that looks like this:
> [...]
> > > My question is that the JSON I have to parse the IP
On Mon, 30 Jan 2017 07:14:23 -0800 (PST)
Rich wrote:
> If I have JSON that looks like this:
[...]
> > My question is that the JSON I have to parse the IPAddr is not
> > always the
> same. AND there are 50+ IPAddr= blocks... For example:
>
> > {
> >"value" : {
> > "IPAddr=10.1.1.12" :
The open source backend code for The Things Network uses gRPC for communication
between the three (or maybe more now) different components of the server that
communicate with each other in a serial, bidirectional fashion
--
You received this message because you are subscribed to the Google Grou
I try to use CGO on Windows
I installed Mingw64 from here:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/
My Go env vars are like so:
set CC=i686-w64-mingw32-gcc.exe
set GOROOT=e:\programs\go64
set GOPATH=e:\src\go
set GOOS=wi
If I have JSON that looks like this:
>
> {
>
>"value" : {
>
> "IPAddr=10.1.1.12" : {
>
> "ReplyTime" : {
>
> "minTime" : 0,
>
> "maxTime" : 0,
>
> "averageTime" : 0
>
> }
>
> }
>
> }
>
> }
>
> Normally you'd setup a struct:
For anyone who wants to build a windows .exe with go-sdl2 and opengl, and
has an optimus driver, and wants to ensure that
the high performance gpu is selected by default for their final product, I
will document my findings here
I found the followingsolution, which can be proven that it work
About cache purge/delete i found answer, that i can add to cache key
TTL via timestamp or something like this. What about disk cache?
2017-01-30 16:15 GMT+03:00 Vasiliy Tolstov :
> Hi! I have two servers that acts like frontend to openstack swift backends.
> So in go i want to write frontend web s
A tutorial to build a simple distributed one-value database (as the title
sais):
https://jacobmartins.com/2017/01/29/practical-golang-building-a-simple-distributed-one-value-database-with-hashicorp-serf/
Please comment with feedback!
--
You received this message because you are subscribed to th
Hi! I have two servers that acts like frontend to openstack swift backends.
So in go i want to write frontend web server that fetches data from backend.
Groupcache able to almost that i need, but also i need to have ability
to force purge cached data for specific location. In memory cache is
fine,
On Wednesday, January 25, 2017 at 5:48:44 PM UTC-5, John Souvestre wrote:
>
> Does this mean that there is no way to call this function?
>
>func h(func()(int, bool)) {}
>
No, you can call it by passing in a function value f itself instead of its
result values f(). Using f in the top post:
38 matches
Mail list logo