[go-nuts] net.InterfaceAddrs() error and returned addr slice

2019-05-15 Thread Vasiliy Tolstov
Hi! I have error from net.InterfaceAddrs() like route ip+net: no such
network interface
i think that error happened because i have docker running that
creates/deletes interfaces in my system.
My question is - does returned slice from InterfaceAddrs filed always,
or in case of error in always nil? As i understand go uses netlink to
get all interfaces and when tries to get address from interface that
already gone, this error happened.
In my case this error not fatal, i only need to know all local unicast
addresses. So if some interface is gone - this is not fatal, but i
need to get all available ip.
So if this function not fills the slice , i need to use different
method to get all addresses.

Can you helps me?
P.S. Error not easy to reproduce in my case, so i can't easy check
does InterfaceAddrs slice filled in case of error.

-- 
Vasiliy Tolstov,
e-mail: v.tols...@selfip.ru

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CACaajQt6P%3DgsQ_%2B2mgsJ-%3Dayxv3Gh-AbkpF_J4N4o4wziK5K8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Go documentation - how to determine what implements an interface?

2019-05-15 Thread 'White Hexagon' via golang-nuts

bytes.Reader is what I was looking for, thanks all!

Seems like if it this information can be generated, then it should probably 
be included in the main documentation?  I don't know how anyone new to the 
language would ever work that out otherwise.

I have vscode 1.33, which support guru (using .0.9.2 of the go tools), but 
I don't see the option for 'implements'.

macos 10.12.4
go 1.12.5

Cheers
Peter

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a1b01c89-06e9-4998-8c74-505628c5ee08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: Go documentation - how to determine what implements an interface?

2019-05-15 Thread Caleb Spare
To summarize, there are three main concrete types in the standard
library that provide ReadSeeker functionality:

*os.File
*bytes.Reader
*strings.Reader

On Wed, May 15, 2019 at 12:33 PM Sam Mortimer  wrote:
>
> There is guru 
> (https://docs.google.com/document/d/1_Y9xCEMj5S-7rv2ooHpZNH15JgRT5iM742gJkw5LtmQ/edit)
>  but it's intended for editors not humans.   I suppose that means perhaps you 
> could use one of the editors that uses guru ?
>
> Regards,
> -Sam.
>
> src/io/io.go:#5381 is where io.ReadSeeker is defined:
>
> $ guru implements src/io/io.go:#5381 |grep gomaster/src |grep -v _test.go 
> |sort
> gomaster/src/bytes/reader.go:18.6-18.11: is implemented by pointer type 
> *bytes.Reader
> gomaster/src/cmd/compile/internal/gc/iimport.go:241.6-241.17: is implemented 
> by pointer type *cmd/compile/internal/gc.importReader
> gomaster/src/cmd/go/internal/lockedfile/lockedfile.go:24.6-24.9: is 
> implemented by struct type cmd/go/internal/lockedfile.File
> gomaster/src/cmd/go/internal/lockedfile/lockedfile.go:31.6-31.11: is 
> implemented by struct type cmd/go/internal/lockedfile.osFile
> gomaster/src/cmd/go/internal/modfetch/codehost/vcs.go:450.6-450.17: is 
> implemented by struct type cmd/go/internal/modfetch/codehost.deleteCloser
> gomaster/src/debug/elf/reader.go:13.6-13.16: is implemented by struct type 
> debug/elf.errorReader
> gomaster/src/debug/elf/reader.go:37.6-37.25: is implemented by pointer type 
> *debug/elf.readSeekerFromReader
> gomaster/src/go/internal/gcimporter/iimport.go:21.6-21.14: is implemented by 
> struct type go/internal/gcimporter.intReader
> gomaster/src/internal/poll/fd_unix.go:18.6-18.7: is implemented by pointer 
> type *internal/poll.FD
> gomaster/src/io/io.go:115.6-115.11: implements Seeker
> gomaster/src/io/io.go:145.6-145.15: interface type ReadSeeker
> gomaster/src/io/io.go:157.6-157.20: is implemented by interface type 
> ReadWriteSeeker
> gomaster/src/io/io.go:461.6-461.18: is implemented by pointer type 
> *SectionReader
> gomaster/src/io/io.go:77.6-77.11: implements Reader
> gomaster/src/mime/multipart/formdata.go:160.6-160.9: is implemented by 
> interface type mime/multipart.File
> gomaster/src/mime/multipart/formdata.go:169.6-169.22: is implemented by 
> struct type mime/multipart.sectionReadCloser
> gomaster/src/net/http/fs.go:93.6-93.9: is implemented by interface type 
> net/http.File
> gomaster/src/os/exec/exec.go:562.6-562.14: is implemented by struct type 
> os/exec.closeOnce
> gomaster/src/os/types.go:16.6-16.9: is implemented by pointer type *os.File
> gomaster/src/strings/reader.go:17.6-17.11: is implemented by pointer type 
> *strings.Reader
>
>
> On Wednesday, May 15, 2019 at 7:56:17 AM UTC-7, White Hexagon wrote:
>>
>> I have another strange interface with the Go AWS SDK.  The PutObject is 
>> expecting the data as an: io.ReadSeeker
>>
>> I imagine there is something implementing this in Go.  But my question is 
>> how would a new user find this information?  The go documentation for the 
>> API just tells me there is a Reader and a Seeker but not what might be 
>> implementing the interface.  I imagine this is difficult to generate since 
>> there is no explicit keyword 'implements' but I also imagine it is 
>> documented somewhere?
>>
>> Cheers
>> Peter
>> go1.12.1
>
> --
> 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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/a4bdba7c-d79c-46e8-9cfc-302444de8262%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAGeFq%2Bn%2BBwhoc65Hm-outBfikd1Dom%2BB3-6DgRnQ3JKwuvORcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Go documentation - how to determine what implements an interface?

2019-05-15 Thread Sam Mortimer
There is guru (
https://docs.google.com/document/d/1_Y9xCEMj5S-7rv2ooHpZNH15JgRT5iM742gJkw5LtmQ/edit)
 
but it's intended for editors not humans.   I suppose that means perhaps 
you could use one of the editors that uses guru ?

Regards,
-Sam.

src/io/io.go:#5381 is where io.ReadSeeker is defined:

$ guru implements src/io/io.go:#5381 |grep gomaster/src |grep -v _test.go 
|sort
gomaster/src/bytes/reader.go:18.6-18.11: is implemented by pointer type 
*bytes.Reader 
gomaster/src/cmd/compile/internal/gc/iimport.go:241.6-241.17: is 
implemented by pointer type *cmd/compile/internal/gc.importReader 
gomaster/src/cmd/go/internal/lockedfile/lockedfile.go:24.6-24.9: is 
implemented by struct type cmd/go/internal/lockedfile.File 
gomaster/src/cmd/go/internal/lockedfile/lockedfile.go:31.6-31.11: is 
implemented by struct type cmd/go/internal/lockedfile.osFile 
gomaster/src/cmd/go/internal/modfetch/codehost/vcs.go:450.6-450.17: is 
implemented by struct type cmd/go/internal/modfetch/codehost.deleteCloser 
gomaster/src/debug/elf/reader.go:13.6-13.16: is implemented by struct type 
debug/elf.errorReader 
gomaster/src/debug/elf/reader.go:37.6-37.25: is implemented by pointer type 
*debug/elf.readSeekerFromReader 
gomaster/src/go/internal/gcimporter/iimport.go:21.6-21.14: is implemented 
by struct type go/internal/gcimporter.intReader 
gomaster/src/internal/poll/fd_unix.go:18.6-18.7: is implemented by pointer 
type *internal/poll.FD 
gomaster/src/io/io.go:115.6-115.11: implements Seeker 
gomaster/src/io/io.go:145.6-145.15: interface type ReadSeeker 
gomaster/src/io/io.go:157.6-157.20: is implemented by interface type 
ReadWriteSeeker 
gomaster/src/io/io.go:461.6-461.18: is implemented by pointer type 
*SectionReader 
gomaster/src/io/io.go:77.6-77.11: implements Reader 
gomaster/src/mime/multipart/formdata.go:160.6-160.9: is implemented by 
interface type mime/multipart.File 
gomaster/src/mime/multipart/formdata.go:169.6-169.22: is implemented by 
struct type mime/multipart.sectionReadCloser 
gomaster/src/net/http/fs.go:93.6-93.9: is implemented by interface type 
net/http.File 
gomaster/src/os/exec/exec.go:562.6-562.14: is implemented by struct type 
os/exec.closeOnce 
gomaster/src/os/types.go:16.6-16.9: is implemented by pointer type *os.File 
gomaster/src/strings/reader.go:17.6-17.11: is implemented by pointer type 
*strings.Reader


On Wednesday, May 15, 2019 at 7:56:17 AM UTC-7, White Hexagon wrote:
>
> I have another strange interface with the Go AWS SDK.  The PutObject is 
> expecting the data as an: io.ReadSeeker
>
> I imagine there is something implementing this in Go.  But my question is 
> how would a new user find this information?  The go documentation for the 
> API just tells me there is a Reader and a Seeker but not what might be 
> implementing the interface.  I imagine this is difficult to generate since 
> there is no explicit keyword 'implements' but I also imagine it is 
> documented somewhere?
>
> Cheers
> Peter
> go1.12.1
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a4bdba7c-d79c-46e8-9cfc-302444de8262%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Go documentation - how to determine what implements an interface?

2019-05-15 Thread Tamás Gulácsi

2019. május 15., szerda 16:56:17 UTC+2 időpontban White Hexagon a 
következőt írta:
>
> I have another strange interface with the Go AWS SDK.  The PutObject is 
> expecting the data as an: io.ReadSeeker
>
> I imagine there is something implementing this in Go.  But my question is 
> how would a new user find this information?  The go documentation for the 
> API just tells me there is a Reader and a Seeker but not what might be 
> implementing the interface.  I imagine this is difficult to generate since 
> there is no explicit keyword 'implements' but I also imagine it is 
> documented somewhere?
>
> Cheers
> Peter
> go1.12.1
>

Just check the definition:https://golang.org/pkg/io/#ReadSeeker
Anything that implements a proper Read and Seek method, also implements the 
io.ReadSeeker interface.

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/adbea23d-3150-4bed-a183-e8fcb8404d0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Go documentation - how to determine what implements an interface?

2019-05-15 Thread 'White Hexagon' via golang-nuts
I have another strange interface with the Go AWS SDK.  The PutObject is 
expecting the data as an: io.ReadSeeker

I imagine there is something implementing this in Go.  But my question is 
how would a new user find this information?  The go documentation for the 
API just tells me there is a Reader and a Seeker but not what might be 
implementing the interface.  I imagine this is difficult to generate since 
there is no explicit keyword 'implements' but I also imagine it is 
documented somewhere?

Cheers
Peter
go1.12.1

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b332ec93-3c20-4128-bd4e-552d0daf0336%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: x/mobile: Feature, add "-target=io/arm,ios/386" and "-nobitcode" to bind command

2019-05-15 Thread constantine
I ran this command:

brew install go --*HEAD*

Now Xcode compiles without an error and ENABLE_BITCODE=YES



On Tuesday, May 14, 2019 at 9:18:12 PM UTC-7, Tristian Azuara wrote:
>
> Hi!,
>
> gomobile does not produce BITCODE enabled frameworks,  (AFAIK) you have to 
> set the XCode `ENABLE_BITCODE` build setting to `NO`, `gomobile` (the 
> latest version) automatically adds the `-fembed-bitcode` as C flag, here 
> you can find a better explanation of it:
>
>  * https://stackoverflow.com/a/34965178
>
> On Tuesday, May 14, 2019 at 9:00:32 PM UTC-7, const...@topinvestor.app 
> wrote:
>>
>> When I compile with:
>> gomobile bind -target=ios -tags="ios" -v mygomobileios
>>
>>
>> and importing the generated Mygomobileios.framework
>>
>> I get an error:
>>
>> ld: 
>> '/mygo/src/mygomobileios/gomobileios_test/Mygomobileios.framework/Mygomobileios(go.o)'
>>  
>> does not contain bitcode. You must rebuild it with bitcode enabled (Xcode 
>> setting ENABLE_BITCODE), obtain an updated library from the vendor, or 
>> disable bitcode for this target. for architecture arm64
>>
>> clang: error: linker command failed with exit code 1 (use -v to see 
>> invocation)
>>
>> Which indicates the generated framework does not contain bitcode.
>>
>> Ho to get the bitcode generated?
>>
>> On Monday, April 1, 2019 at 9:30:23 AM UTC-7, Tristian Azuara wrote:
>>>
>>> Hi Elias, thank you for the quick reply, I see, you're correct it does 
>>> support the archs for ios, I had not tried it for ios, because the 
>>> documentation just mentions that you can specify specific instruction sets 
>>> when binding for android:
>>>
>>> $ gomobile bind --help
>>>
>>>
>>> By default, -target=android builds shared libraries for all supported

 instruction sets (arm, arm64, 386, amd64). A subset of instruction sets

 can be selected by specifying target type with the architecture name. 
> E.g.,

 -target=android/arm,android/386.


> For -target ios, gomobile must be run on an OS X machine with Xcode

 installed. The generated Objective-C types can be prefixed with the 
> -prefix

 flag.


>>> There's no mention that you can filter out instruction sets for iOS but 
>>> I just tested using it and it works!, thank you for pointing that out.
>>>
>>> Now, regarding the bitcode part basically, because it's added 
>>> automatically; any libraries that don't have BITCODE enabled don't link 
>>> properly, here's some sample output:
>>>
>>> GO111MODULE=off gomobile bind -v -target=ios/arm,ios/arm64,ios/amd64 
>>> -tags=ios example.com/mobile
>>> runtime/cgo
>>> golang.org/x/mobile/internal/mobileinit
>>> os/user
>>> net
>>> example.com/pycore
>>> example.com/jscore
>>> # example.com/pycore
>>> ld: warning: ignoring file pycore/libpython-scriptengine.a, file was 
>>> built for archive which is not the architecture being linked (armv7): 
>>> pycore/libpython-scriptengine.a
>>> ld: warning: object file (/Users/tristian/go/src/
>>> example.com/pycore/libpython-scriptengine-ios.a(python-scriptengine-ios.o)) 
>>> was built for newer iOS version (9.3) than being linked (7.0)
>>> ld: '/Users/tristian/go/src/
>>> example.com/pycore/libpython-scriptengine-ios.a(python-scriptengine-ios.o)' 
>>> does not contain bitcode. You must rebuild it with bitcode enabled (Xcode 
>>> setting ENABLE_BITCODE), obtain an updated library from the vendor, or 
>>> disable bitcode for this target. for architecture armv7
>>> clang: error: linker command failed with exit code 1 (use -v to see 
>>> invocation)
>>> # example.com/jscore
>>> ld: warning: ignoring file jscore/libscriptengine-ios-x86_64.a, file was 
>>> built for archive which is not the architecture being linked (armv7): 
>>> jscore/libscriptengine-ios-x86_64.a
>>> ld: warning: object file (/Users/tristian/go/src/
>>> example.com/jscore/libscriptengine-ios-arm.a(test_lib_for_ios.o)) was 
>>> built for newer iOS version (10.2) than being linked (7.0)
>>> ld: '/Users/tristian/go/src/
>>> example.com/jscore/libscriptengine-ios-arm.a(test_lib_for_ios.o)' does 
>>> not contain bitcode. You must rebuild it with bitcode enabled (Xcode 
>>> setting ENABLE_BITCODE), obtain an updated library from the vendor, or 
>>> disable bitcode for this target. for architecture armv7
>>> clang: error: linker command failed with exit code 1 (use -v to see 
>>> invocation)
>>> gomobile: darwin-arm: go build -tags ios ios -v -buildmode=c-archive -o 
>>> /var/folders/g1/v3hz1sm92nv7wbzpg3dx_h_hgp/T/gomobile-work-974051835/mobile-arm.a
>>>  
>>> gobind failed: exit status 2
>>>
>>> make: *** [Mobile.framework] Error 1
>>>
>>> This would force us to recompile libpython-scriptengine-ios.a or any 
>>> other libraries that don't have bitcode support
>>>
>>> When I comment out -fembed-bitcode I no longer see that error.
>>>
>>> Best, Tristian
>>>
>>> On Monday, April 1, 2019 at 12:09:35 AM UTC-7, ma...@eliasnaur.com 
>>> wrote:

 Hi,

 The -target flag does support architecture