[go-nuts] Re: Controlling VMware ESXi from Go

2016-07-21 Thread S . Çağlar Onur
Hey Brad,

[just summarizing our twitter conversation here for reference] 
 
On Thursday, July 21, 2016 at 5:11:59 PM UTC-7, bradfitz wrote:
>
> If you have experience controlling VMware ESXi nodes from Go, could you 
> point me at recommended packages? Or API reference?
>
> Note: no vCenter, no vSphere management console, no Windows. Only Linux 
> (or OS X), and only the basic level of ESXi.
>
> I'm new to all this.
>

Unfortunately free ESXi license disables the API, but an evaluation license 
(valid for 60 days) will enable it. We are trying to change that licensing 
restriction since we want vSphere Integrated Containers [1] usable on free 
ESXi.

You can find the Go library for the VMware vSphere API (ESXi/vCenter) at 
[2] or download and use the govc, a CLI built on top of govmomi, from [3] 

[1] https://github.com/vmware/vic
[2] https://github.com/vmware/govmomi
[3] https://github.com/vmware/govmomi/releases

Best,
 

> Thanks!
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] getting the receiver from a bound method

2016-07-21 Thread Ian Lance Taylor
On Thu, Jul 21, 2016 at 8:52 PM, Alex Flint  wrote:
> Is it possible to use reflection to retrieve the value of x from
> reflect.ValueOf(x.SomeMethod) where x is an instance of some struct type?

No.  Approximately the only thing you can do with a reflect.Value that
is a function is call it.

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] getting the receiver from a bound method

2016-07-21 Thread Alex Flint
Is it possible to use reflection to retrieve the value of x
from reflect.ValueOf(x.SomeMethod) where x is an instance of some struct
type?

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Go 1.7 Release Candidate 3 is released

2016-07-21 Thread Chris Broadfoot
A couple people requested a changelog between release candidates. I'll try 
to remember to include that for the 1.8 release candidates (we don't plan 
to do a 1.7rc4).

GitHub has a nice view for commits between refs.

Here's what was in 1.7rc2 (very small):
https://github.com/golang/go/compare/go1.7rc1...go1.7rc2

1.7rc3 has quite a few more changes:
https://github.com/golang/go/compare/go1.7rc2...go1.7rc3

I hope that's helpful.

Cheers,
Chris

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Controlling VMware ESXi from Go

2016-07-21 Thread James
Take a look at govmomi -- works well with individual ESXi nodes.

On Thu, Jul 21, 2016 at 20:11 Brad Fitzpatrick  wrote:

> If you have experience controlling VMware ESXi nodes from Go, could you
> point me at recommended packages? Or API reference?
>
> Note: no vCenter, no vSphere management console, no Windows. Only Linux
> (or OS X), and only the basic level of ESXi.
>
> I'm new to all this.
>
> Thanks!
>
>
> --
> 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.
> 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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Controlling VMware ESXi from Go

2016-07-21 Thread Tim Hawkins
Do they have an OpenStack wrapper for ESXi?

If they do that is probaly an easier target to be looking at#

http://docs.openstack.org/kilo/config-reference/content/vmware.html

It does seem to exist for vSphere.

https://github.com/openstack/golang-client

Openstack golang client.

Upside is that your system with the proper care and attention, will work
for any cloud system that has an openstack interface.



On 22 Jul 2016 8:11 a.m., "Brad Fitzpatrick"  wrote:

> If you have experience controlling VMware ESXi nodes from Go, could you
> point me at recommended packages? Or API reference?
>
> Note: no vCenter, no vSphere management console, no Windows. Only Linux
> (or OS X), and only the basic level of ESXi.
>
> I'm new to all this.
>
> Thanks!
>
>
> --
> 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.
> 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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Controlling VMware ESXi from Go

2016-07-21 Thread Brad Fitzpatrick
If you have experience controlling VMware ESXi nodes from Go, could you
point me at recommended packages? Or API reference?

Note: no vCenter, no vSphere management console, no Windows. Only Linux (or
OS X), and only the basic level of ESXi.

I'm new to all this.

Thanks!

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Go 1.7 Release Candidate 3 is released

2016-07-21 Thread Chris Broadfoot
Hello gophers,

We have just released go1.7rc3, a release candidate for Go 1.7.
It is cut from release-branch.go1.7 at the revision tagged go1.7rc3.

Please help us by testing your Go programs with the release, and report any 
problems using the issue tracker:
  https://golang.org/issue/new

You can download binary and source distributions from the usual place: 
  https://golang.org/dl/#go1.7rc3

To find out what has changed in Go 1.7, read the draft release notes:
  https://tip.golang.org/doc/go1.7

Documentation for Go 1.7 is available at:
  https://tip.golang.org/
  
We plan to release the final version of Go 1.7 in the first week of August, 
as per the release timeline:
  https://github.com/golang/go/wiki/Go-Release-Cycle#timeline

Cheers,
Chris

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Calling go functions from command line

2016-07-21 Thread carlfnienaber
You can add the functions to a map and use the string representation passed 
in from the command line to execute them

var funcs map[string]func()

func add(){
  ... get parameters from command line
}

func main(){
  func, ok := funcs[funcName]
  ... test ok

  func()
}

On Thursday, 21 July 2016 12:14:04 UTC-7, christ...@google.com wrote:
>
> Cgo enables us to call C functions from Go programs, and we can run C 
> functions from command line.
>
> Are we able to call Go functions directly from command line?
>
> For example if I have a function in Go:
>
> func add(a, b int) int {
>   return a + b
> }
>
> Can I somehow invoke this from bash?
>
>
>
> Thanks!
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] ioutil.WriteFile and Sync

2016-07-21 Thread Konstantin Khomoutov
On Thu, 21 Jul 2016 21:17:38 +0200
Manlio Perillo  wrote:

> >> What is the reason why ioutil.WriteFile does not call File.Sync?
> >
> > I'd say that's because to inhibit this behaviour when needed you'd
> > need to implement ioutil.WriteFileNoSync() or have an option flag
> > as an argument (remember CreateFile() of Win32 API?).
> 
> I'm curious to know why one wants to inhibit the durability behaviour.
> AFAIK, several design choices of Go and its standard library are
> designed to make program safe and robust.
> WriteFile does not follow these principles.

Well, I definitely sympathize your line of reasoning, but it's not that
simple.  For instance, a WriteFile() truncates the file when it exists.
A well-written application which wants to _replace_ a file must go this
route:

I. Simple approach:

1) Write a _new_ file (that is, opened with O_CREAT|O_EXCL) aside the
   old one.
2) rename() the new file over the old one.

II. "Robust" approach:

0) Open the directory entry containing the file.
1) Same as (1) above.
2) fsync() the new file's contents.
3) rename() the new file over the old one.
4) fsync() the directory entry containing the file.

Here, (4) is an oft-forgotten task, and it requires the openat()
/ renameat() and other whateverat() functions, and the step (0).

Now here comes another consideration: certain file operations are
atomic on a scale larger than a single file.  Consider a package
management program: when it unpacks a package, it makes little sense
making sure each file it unpacks is fdsync()-ed right after it was
written -- simple because it unpacking is terminated, it doesn't matter
whether the files extracted so far actually hit the underlying medium.
So we can unpack and then issue syncfs(2) all them all at once.

What I'm leading to, is that WriteFile() is just a narrowly-scoped
utility function.  For advances cases you will almost inevitably
a) think your strategy through; b) write complex custom code.

You might start exploring this interesting realm from, say [1]. ;-)

1. 
https://blog.valerieaurora.org/2009/04/16/dont-panic-fsync-ext34-and-your-data/

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Calling go functions from command line

2016-07-21 Thread Rick
See os.Exec. Also there is a nice 
project https://github.com/codeskyblue/go-sh that friendly's the stdlib up.

On Thursday, 21 July 2016 12:14:04 UTC-7, christ...@google.com wrote:
>
> Cgo enables us to call C functions from Go programs, and we can run C 
> functions from command line.
>
> Are we able to call Go functions directly from command line?
>
> For example if I have a function in Go:
>
> func add(a, b int) int {
>   return a + b
> }
>
> Can I somehow invoke this from bash?
>
>
>
> Thanks!
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] ioutil.WriteFile and Sync

2016-07-21 Thread Sam Whited
On Thu, Jul 21, 2016 at 2:17 PM, Manlio Perillo
 wrote:
> On Thu, Jul 21, 2016 at 8:39 PM, Konstantin Khomoutov
> I'm curious to know why one wants to inhibit the durability behaviour.
> AFAIK, several design choices of Go and its standard library are
> designed to make program safe and robust.
> WriteFile does not follow these principles.

File access in Unix and Unix-like systems is a lot like Go: If you
conform to its design decisions and do things the way it wants you to
do them, you'll end up having a pretty good time; however, if you try
to make it conform to the way you imagine things should work, you're
just going to end up creating problems for yourself down the road.

If you don't absolutely need to sync (or don't know if you need to
sync or not but aren't seeing problems), don't. Let the kernel handle
how and when your files get written (or your network gets flushed, or
whatever the case may be), and it will be able to optimize under the
hood, make the best utilization of its file cache, and generally do
all the good things it wants to do for you.

—Sam

-- 
Sam Whited
pub 4096R/54083AE104EA7AD3

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] ioutil.WriteFile and Sync

2016-07-21 Thread Manlio Perillo
Il giorno giovedì 21 luglio 2016 21:28:09 UTC+2, Axel Wagner ha scritto:
>
> There are almost no use cases that require syncing the file. The operating 
> system is designed with a good buffering layer for a reason. If you do have 
> such need, it is trivial to write your own version of WriteFile that does 
> this.
>
>  
Indeed, I remember having reviewed a backup tool written in Go, and there 
were no calls to File.Sync...

Manlio 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] ioutil.WriteFile and Sync

2016-07-21 Thread 'Axel Wagner' via golang-nuts
There are almost no use cases that require syncing the file. The operating
system is designed with a good buffering layer for a reason. If you do have
such need, it is trivial to write your own version of WriteFile that does
this.

On Thu, Jul 21, 2016 at 9:17 PM, Manlio Perillo 
wrote:

> On Thu, Jul 21, 2016 at 8:39 PM, Konstantin Khomoutov
>  wrote:
> > On Thu, 21 Jul 2016 11:17:18 -0700 (PDT)
> > Manlio Perillo  wrote:
> >
> >> What is the reason why ioutil.WriteFile does not call File.Sync?
> >
> > I'd say that's because to inhibit this behaviour when needed you'd need
> > to implement ioutil.WriteFileNoSync() or have an option flag as an
> > argument (remember CreateFile() of Win32 API?).
>
> I'm curious to know why one wants to inhibit the durability behaviour.
> AFAIK, several design choices of Go and its standard library are
> designed to make program safe and robust.
> WriteFile does not follow these principles.
>
> > [...]
>
> Manlio
>
> --
> 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.
> 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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Calling go functions from command line

2016-07-21 Thread christhompson via golang-nuts
Cgo enables us to call C functions from Go programs, and we can run C 
functions from command line.

Are we able to call Go functions directly from command line?

For example if I have a function in Go:

func add(a, b int) int {
  return a + b
}

Can I somehow invoke this from bash?



Thanks!

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] ioutil.WriteFile and Sync

2016-07-21 Thread Konstantin Khomoutov
On Thu, 21 Jul 2016 11:17:18 -0700 (PDT)
Manlio Perillo  wrote:

> What is the reason why ioutil.WriteFile does not call File.Sync?

I'd say that's because to inhibit this behaviour when needed you'd need
to implement ioutil.WriteFileNoSync() or have an option flag as an
argument (remember CreateFile() of Win32 API?).
The way it's implemented, it does exactly one task.
A version calling Sync would be like 10 lines of code at most,
I imagine.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] ioutil.WriteFile and Sync

2016-07-21 Thread Jan Mercl
On Thu, Jul 21, 2016 at 8:17 PM Manlio Perillo 
wrote:

> What is the reason why ioutil.WriteFile does not call File.Sync?

That would be harmful.

-- 

-j

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Go plugin for IntelliJ update with support for 2016.2 IDEs and a lot more

2016-07-21 Thread Florin Pățan
Hi all,


The Go plugin for IntelliJ (and all the other JetBrains IDEs + Android 
Studio) has just received a new update.

Among the the most important things the plugin adds are:
- a lot of new inspections and quickfixes
- completion improvements
- improved overall performance
- support for the latest 2016.2 IDEs

You can learn more about it here: http://go-ide.com/releases/0.11.1725/
If you want to test it out, you can do so in any IDE from JetBrains, 
including IntelliJ IDEA Community (free & open-source IDE).

Develop with pleasure!

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: What dependency management tool do you use?

2016-07-21 Thread Jeremy Echols
I hesitate to respond with all the emotions flying high, but I love gb.  
Its philosophy seems to match my own very well, pulls dependencies nicely 
with the built-in vendor plugin, doesn't force vendoring, allows caching 
semver projects externally by version number, lets my code live in src/ 
(which I generally prefer to top-level code mixed in with readmes), etc.

I wouldn't claim it's the best, but it's definitely eased some of my 
biggest frustrations with vanilla `go build`.

On Tuesday, July 12, 2016 at 1:15:29 PM UTC-7, Johann Höchtl wrote:
>
> I use godep. There has been lots of rumour lately to use gb.
>
> What do others use?
>
> If there is a blog post available somewhere comparing the pros and cons, 
> please provide one.
> I know https://github.com/golang/go/wiki/PackageManagementTools
>
> I also like the idea of manul to use git submodules 
> https://github.com/kovetskiy/manul
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Why can't I access port 6060 (pprof) in remote host

2016-07-21 Thread Shawn Milochik
Because of this:  http.ListenAndServe("localhost:6060", nil)

You're only listening on localhost. Just use :6060 or 0.0.0.0:60 or your
actual public-facing IP.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Pure Golang Online Mandelbrot Viewer and MORE

2016-07-21 Thread pragmaticwiz
Drawing a box is exactly how earlier versions worked. I did this, first, 
because other renderers did the same. I found drawing a box was not intuitive 
at all.

People just could not figure it out.

The reason is that there is no conceptual mapping unless you have already seen 
that behaviour in another program.

What happens is, people do a very small click. This makes a tiny box and they 
zoom into some tiny area and wonder what happened.

So small click = ginormous change.

My UI design has the property that small-click = small-change and big-click = 
big-change.

Now I can send it to people with no instructions! 

The problems you describe is that it requires a loading/aspect ratio munging 
indicator i.e. https://github.com/johnny-morrice/webdelbrot/issues/10

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Pure Golang Online Mandelbrot Viewer and MORE

2016-07-21 Thread John Morrice
hsmyers: as a pioneer I really appreciate your input!  I was planning to 
run godelbrot on my Pi, so I will definitely check out your venerable 
FracZoom program for RISC.

*However, *drawing an outline box is exactly what earlier versions did.

I found that people just couldn't figure it out.  

What happens is that they would click randomly a whole bunch of times. Then 
they would zoom into a tiny area of space, and decide my program is broken.

No-one even noticed the box until they stop panicking.  By then they're 
looking at a large area of nothing.

*It was really unintuitive.*

The reason is that there is no conceptual mapping between the mouse pointer 
and drawing a box to zoom a fractal unless you have seen it before.

So I started looking for a conceptual map.  I came upon the following 
realisation:

With a box, small clicks = massive change.  Long click (dragging the box) = 
small change.

With my evolved method, small clicks = small change and long clicks = big 
change.

I know that a bunch of different fractal programs use the box method. 
 Arguably, it is more efficient *if you already know about it*.

You are correct though that the box should stay up on screen; there should 
be a progress indicator.   This is covered in the following 
issue https://github.com/johnny-morrice/webdelbrot/issues/10

I actually really like Pierre Durand's interface.  The digital zoom effect 
is very nice.  I'd like to move to that some time.  

However, there are tonnes of interactive-focussed renderers in the vein of 
Xaos.  Some in pure javascript with openGL.  

That's fine but it's been done and I don't really want to go down that 
path; my focus is on movie generation, and creating a testbed for tinkering 
e.g. extensibility.

Johnny 


On Thursday, July 21, 2016 at 7:42:00 AM UTC+1, hsmyers wrote:
>
> As a bit of a fractal UI pioneer (see FracZooms and related), my quick 
> suggestion is to allow for drawing of a outline style box(i.e. edge only) 
> with mouse or finger. Leave outline in place until user either draws 
> another, or indicates desire to zoom on selection. Then zoom to the extent 
> of the box. Wash, rinse, repeat. As it stands now the interface for zooming 
> doesn't seem intuitive. But your goal is right on the money!!
>
> On Wed, Jul 20, 2016 at 11:08 PM, Pierre Durand  > wrote:
>
>> https://mandelbrot.pierredurand.fr
>>
>> --
>> 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...@googlegroups.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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Why can't I access port 6060 (pprof) in remote host

2016-07-21 Thread Yongxiu Wu
I am using net/http/pprof to monitor my program. 
I import the package _"net/http/pprof" ,and add some code snippets as follow
*...*
func main(){
debug()
*...*
}

func debug(){
  go func(){
  http.ListenAndServe("localhost:6060", nil)
}()
}

After that, I can access it in my localhost (ip is 172.20.x.x )















Then I want to monitor my test server whose ip is 192.168.x.x, however it 
doesn't work.


















I checked my test server and found

First, the 6060 port is start



Second, the program is running correctly,and it contains two port,one is 
9606 and another is 6060.

I start the 9606 by 

http.ListenAndServe(":9606",nil) 

And I can access the 9606 port.






Third, to check whether it is caused by the two nil 

http.ListenAndServe(":9606",nil)

http.ListenAndServe(":6060",nil)


I rewrite a test snippet as follow, the nil is replaced by serverMuxA. But 
saddly, it still doesn't work.


 


And
 
now, I have no idea about it. Could  anyone can help me? Thanks all ! 


-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Godoc templates custom functions

2016-07-21 Thread matteo . suppo


Ok so I wanted some nice markdown docs for my repos.
https://github.com/robertkrimen/godocdown is not being updated in 3 years 
and it has some issues.


I decided to try with vanilla godoc and templates. Unfortunately it messes 
up with whitespace. Do you know if there's a way to make godoc accept 
custom functions for the templates?


Instead of calling {{comment_text .Doc "" ""}}

it would be nice to be able to call {{comment_md .Doc "" ""}}

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: [ANN] UniDoc PDF Toolkit for golang

2016-07-21 Thread Todd Neal

On Wednesday, July 20, 2016 at 6:19:44 PM UTC-5, kristian wrote:
>
> I agree with this.  Go needs a pdf library that is apache, mit or 
> bsd licensed.  
>

Have you seen github.com/jung-kurt/gofpdf?  I think the API is a bit wonky 
as it's derived from FPDF, but it works and uses the MIT license.

- Todd 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] serializing a value using Go syntax

2016-07-21 Thread Peter Waller
The closest thing I'm aware of is . Not sure
if it solves your use case, but might get you some of the way there.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Linux File descriptor question in golang

2016-07-21 Thread Peter Waller
On 21 July 2016 at 12:37, Alex Bligh  wrote:
>
> On Linux (and indeed most if not all POSIX like systems)
> one cannot get a file path from the file descriptor number.
> This is irrespective of programming language used.


While your statement is true generally, it is actually possible so long as
the file descriptor refers to an existing file. Consider:

$ fd2path < main.go
/home/pwaller/.local/src/github.com/pwaller/fd2path/main.go

Code:

package main

import (
"fmt"
"log"
"os"
)

func main() {
fd := os.Stdin.Fd()
fileName, err := os.Readlink(fmt.Sprint("/proc/self/fd/", fd))
if err != nil {
log.Fatal(err)
}
fmt.Println(fileName)
}

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Linux File descriptor question in golang

2016-07-21 Thread Alex Bligh

> On 21 Jul 2016, at 11:02, Homer Li <01jay...@gmail.com> wrote:
> 
> Could I get file path from the file descriptor number ? 
> OS : Linux
> How to write in golang ?

On Linux (and indeed most if not all POSIX like systems)
one cannot get a file path from the file descriptor number.
This is irrespective of programming language used.

Consider what happens if you open a file, then unlink it.
Or open it then rename it. Or open a file with multiple links
to it. Etc.

-- 
Alex Bligh




-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Linux File descriptor question in golang

2016-07-21 Thread Konstantin Khomoutov
On Thu, 21 Jul 2016 18:02:53 +0800
Homer Li <01jay...@gmail.com> wrote:

> Could I get file path from the file descriptor number ?
> OS : Linux
> How to write in golang ?

I'm afraid, you can't.

But as usually in such cases, I have an imminent question: what initial
problem are you trying to solve?

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: What dependency management tool do you use?

2016-07-21 Thread mhhcbon
I will only put some lights on my experience.

*Gopath ect*
Except at the very beginning of my experience with Go, i don't think 
anymore about my GOPATH.
I had setup a go work space as defined by the go core team, and declared 
gopath appropriately.
Since then, every cli project or library, I create will have its folder 
into the GOPATH 
(smthg like ~/gow/src/github.com/mh-cbon/, being a gh user)
Theirs dependencies will never be stored at the root of this path, 
they will be stored into the per project *vendor/* folder.
This folder is always ignored and is automatically managed 
by the dependency manager tool i use, glide.

If i want to modify a dependency, i will fork it.
In this case the fork will exist as a root project into my GOPATH.
The projects depending on it will be modified to import the fork 
rather than the origin until somehow the merge to upstream occurs.

*Reproducible build*

To provide reproducible build, and thus manage my dependencies, 
i have decided to use glide because it does understand the semver mechanic
and it naturally uses go engine mechanics.

For each project, a file describing the dependencies exists on the root of 
the project.
When the project needs to be built against a fresh environment, glide 
install command 
will do the necessary to fetch into the *vendor/* folder the right 
dependencies.
According to the semver rules defined along the dependency graph.

Having reproducible is an important matter, but for flexibility 
semver allows to declare ranges over exact version number 
(ie: ~1.1.1, >=1.1.1 && <1.2.0).
This feature is extremely important when you depend on projects 
you don t maintain yourself, patches will be applied to the final 
product without human effort.

It is also true that such behavior induces a weak contract of confidence 
between 
a provider and a consumer which do not closely work together and can lead to
breakage when the provider did not respect the semver rules.
(IE: publish a new version as a patch instead of a minor / major one)
*Or*, if the consumer did not appropriately declared its dependency rules.

To fix that instability in the dependency graph of the project
 a solution provided by npm was to add a new file
to declare strict dependency rules based not on the latest version 
available, 
but on the version currently installed and consumed by the project
(IE: lookup into the *vendor/* folder to discover the current version).

Such feature must exist for production delivery system.

*Diamond problem*

The situation can occur, and will occur for sure.
There is no ultimate solution to it.
There are some situations where given the dependency tree and its 
semver rules, an automatic answer can be provided with no guarantee
of success besides the verbal semver agreements.

In case of breakage after automatic resolution, one should be able
to refine the version at the root project level.
Refine means to enforce a specific version range within the currently 
acceptable range 
of versions in the dependency graph.

If I come to pull in a new dependency which is not compatible
with the current dependency graph of my project, 
I will be happy the system forbids me to continue that way.

*Other stuff*

- So far, i never read anything about the engine compatibility.
I guess, until now, we leave in a wonderful land, every go release are
always backward compatible.
I hope time will come where the go engine will break, for a brighter future.
but, yet anyone can foresee that so far libraries and projects were not 
tagged
to mark their engine compatibility, which will results into a more chaotic 
world.

- Until now, go documentation was primarily focused to provide
exact and precise behavioral documentation of the api.
I wish some educational effort will be made to detail, explain 
and provide ready-to-go methodologies to setup and publish a project 
with the right guidance to embrace social coding 
(IE: a global namespace is not a good way to embrace social coding and lazy 
dependency).

Go team has provided, what i suspect a tremendous effort, to
provide a really simple and easy environment to build programs.
go build and consorts are really awesome.
cross platform build capability is even more awesome.
go fmt is a strong and good decision.

Go, as a language, is really enjoyable, 
as an environment to publish and share projects, it lacks some efforts.
Let s hope this road toward simplicity will be continued and reach the last 
kilometer
to provide a secure and friendly environment for social coding.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Go is for everyone

2016-07-21 Thread Ralf Schülke
Hi,

Programming language is secondary level.
first must be clear as works as a Computer (machine) production.

In my early time, which was very clear but hard 8bit machines could one 
still imagine today the machine are a thousand times faster and their 
possibilities as well.

Alone GPU, I / O, the kernel and userland programming there is also so much 
you need to know.

In my time, BASIC was the only and my imagination and my own motivation, 
books and friends.

Today, we have the Internet, www and 100 of possibilities. Many new want to 
make games whose examples same (3d games etc). Only this day expenses with 
very large and it takes a long time and can not be done by a single person.

Conclusion:
-  Learn how works a Machine
 (Neumann architecture) or DCPU16 Emu. Number systems, bits & bytes, asm
- Programming paradigms, Unix philosophy, data structures
- Then golang as first language

Personally, I also think that one aspect, about the attitude as a 
programmer:
- Open source vs closed source
- Hacking (white vs black)
- Judge of techniques
- Behave in a network (jargon file)


-- 
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.
For more options, visit https://groups.google.com/d/optout.