Constantine Vassilev | 28 Oct 22:18 2014
Picon

base-10 to base-12 conversion

I have following number representing years in base-10 decimal:
10.5 

the meaning is 10 years and half = 10 years and 6 months.

What I need it when I have the number 10.5 which is in base-10 
to be converted to 10.6 which is in base-12. That way I can get 
the whole part which is 10 representing years and decimal part which
is 6 representing months and print it:  10 years and six months.


--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Karthik Rajagopalan | 28 Oct 20:29 2014
Picon

ppk to pem for go.crypto/ssh

Hi Folks,

Is there a GO package which convert plink generated ppk file to PEM format? I wanted to use go.crypto/ssh under Windows. Unless, I convert to this format, the ssh package is not usable under Windows. Let me know if there are other ways to do it.

-Karthik

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Oscar Saborio | 28 Oct 18:38 2014
Picon

call Go from C

Hi there,


Im Trying to get something like the following to work:

this is a C function:
result_t event_callback_set( event_callback_t  callback )

I need to pass a static funcion to the C API.


From Go:

I need to call the event_callback_set() with a static function that calls Go.

/* #cgo pkg-config: somelib
#include "somelib.h"

static pv_result_t event_cb( parameters...)
{

   result_t   result = FAIL;

   test();

   return result;
}*/
import "C"

/*export test
func test() {
   fmt.Printf("called go")
}*/

func event_callback_set()(result Result_t){
   // Register  callback
   fmt.Printf("Registering callback\n")

   result := result_go[C.event_callback_set(C.event_cb)]

   if (result != OK){
      fmt.Printf("Unable to register callback")
   }
   return result
}

Still no luck...

when compiling I get undefined reference to event_cb

Any suggestions would be appreciated.

Regards,
Oscar.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Paul Lalonde | 28 Oct 18:33 2014
Picon

How to zero an interface

I have a small wrapper for appengine.datastore's Get function that passes the object to fill as an interface:

func (wtmc *WriteThroughMemcache) GetRefresh(c appengine.Context, inoutobj interface{}) error {
 ...
 err = datastore.Get(c, key, inoutobj)
 ...
}

The catch is that datastore.Get merges into the existing object instead of replacing it.  One simple solution is to make sure inoutobj is a zero object on its way in, but this is a burden on the user.
How can I zero inoutobj prior to my call to Get?
Alternately, I can use reflection to make a zero object of the same type, and pass that to Get, but then how do I deep-copy it back over inoutobj?

Thanks,
    Paul


--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Robert Zaremba | 28 Oct 16:50 2014

Are there any tools which will integrate project bundled dependencies with editors?

I've put all details on stackoverflow:

How to do a Go project workspace to work with dependencies tools and go tools?


tl;dr;  I want to make my project leaving in a go workspace (gopath) and bundled dependencies (by gom/godep) working well with go tools (gofmt, gorename ...) and editors (emacs, vim).



--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Benjamin BALET | 28 Oct 16:44 2014
Picon

[OFF TOPIC] Google Inbox invitation

Hello,

This is completely off-topic, but does someone have a Google Inbox Invitation left ?

Thank you in advance.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Péter Szilágyi | 28 Oct 16:09 2014
Picon

Re: Re: Great big mesh of dependencies :D

Hmmm, I'll take a closer look into this too. Thanks a lot :)

On Tue, Oct 28, 2014 at 5:05 PM, Alan Donovan <adonovan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
On 28 October 2014 11:01, Péter Szilágyi <peterke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Thanks, I'll have to take a look at it.

I also made some progress in the mean while. I am currently at renaming/scoping the top level declarations, just found a bug in astutils, so I cannot progress until it's fixed. Yay :(



I wouldn't bother with astutil.  If you want any hope of the program working after the transformation, you need to use the go/types package (as singlefile does) since the problem of identifier resolution in Go is quite subtle and is inextricably linked to type checking.


--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
cameron.boyer | 28 Oct 14:40 2014
Picon

go-oci8 DSN connection problem

Hello,

I have go-oci8 set up in a windows 64 bit env.  I was hoping to connect to an Oracle database.  Trying to get all the tools set up for Oracle has been... a pain.  Lets not worry about "why" but the how.

When following the examples in go-oci8 I pass the connection: "username/password <at> host:1521/db" (as an example).

db, err := sql.Open("oci8", "username/password <at> host:1521/db")

This doesn't return an error, but when I try to query off of it, it errors, with no information. 

I noticed looking though some of the source that oci8 might be trying to get environment variables, specifically the DSN, which would be defined in tsnames.ora.  Is this what oci8 is trying to grab?  

A DSN would look something like:

db = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = 1521)) 
(CONNECT_DATA = 
(SERVER = DEDICATED) 
(SERVICE_NAME = db.some.com) 

I can connect to this Oracle database with other programs in the same environment.  I have also set up my oci8.pc following https://gist.github.com/mnadel/8678269 .  Am I missing something trivial?  Please let me know if there is more information needed.  I'm close to pulling all my hair out.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kevin Pors | 28 Oct 15:12 2014
Picon

http.Client Get() results in EOF from host (HTTPS)

Hi,

Go 1.3.3, Windows, amd64:

See http://play.golang.org/p/cOBB3_UZlh . I'm trying to connect to an API through HTTPS, but establishing a proper connection fails:
  1. TLS 1.0 (handshake failure)
  2. TLS 1.1 (EOF)
  3. TLS 1.2 (EOF)
Trying to create a connection using the OpenSSL suite fails on my Cygwin installation:

$ openssl version
OpenSSL 1.0.1j 15 Oct 2014
$ openssl s_client -connect hosted.datascopeapi.reuters.com:443
CONNECTED(00000003)
2348736:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:184:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 306 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

Forcing TLS 1.0 by providing the switch -tls10 works, however. My Linux box though has no issues (with or without -tld10):

$ openssl version
OpenSSL 0.9.8k 25 Mar 2009
$ openssl s_client -connect hosted.datascopeapi.reuters.com:443
CONNECTED(00000003)
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
... more stuff ...


So my question: why does Go fail to create an HTTPS connection? I have not much experiences with crypto/TLS/SSL. Someone on #golang-nuts hinted that it may as well be a server problem, but I'm still curious if there's a way to find the root cause. 

Regards,
Kevin

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
martin haesler | 28 Oct 15:05 2014
Picon

Testing decoding json

Hallo,

There is a very helpful go appengine example, gotodos, which has a function decodeTodo:

func decodeTodo(r io.ReadCloser) (*Todo, error) {
    defer r
.Close()
   
var todo Todo
    err
:= json.NewDecoder(r).Decode(&todo)
   
return &todo, err
}

A sample todo object:

var testtodo = `{"id": 1, "text": "do this", "created": 1356724843.0, "done": true}`

How can I test this function with testtodo? 

I tried to test it like this:

dec, err := decodeTodo(strings.NewReader(testtodo))

but I'd get an error message, that *strings.Reader does not implement io.ReadCloser (missing Close method).


Thanks in advance,

Martin







--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Paul van Brouwershaven | 28 Oct 15:06 2014

pkix-x509: Order of RDNSequence (Name Constraints and Cross Certificates)

I'm currently running into an issue with the default order of RDNSequence and the creation of certificates that contain Name Constraints (I'm also expecting the same issue with cross certificates). While Go is currently using the same order as in the RFC examples I can't find anything that says that it should be in a specific order. Most certificates on the internet are currently using a different order (while not the same unfortunately), also the certificate from google.com is not using the same order as enforced by go.

For Name Constraints to work properly the Subject of the issued certificate needs to be in the exact order of the Name Constraint.

Say that we have a Name Constraint containing:
C=US, S=California, L=Mountain View, O=Google Inc

Go would currently not be able to fulfill that constraint as the order of any pkix.Name is defined by the order in the ToRDNSequence function:

func (n Name) ToRDNSequence() (ret RDNSequence) {
ret = appendRDNs(ret, n.Country, oidCountry)
ret = appendRDNs(ret, n.Organization, oidOrganization)
ret = appendRDNs(ret, n.OrganizationalUnit, oidOrganizationalUnit)
ret = appendRDNs(ret, n.Locality, oidLocality)
ret = appendRDNs(ret, n.Province, oidProvince)
ret = appendRDNs(ret, n.StreetAddress, oidStreetAddress)
ret = appendRDNs(ret, n.PostalCode, oidPostalCode)
if len(n.CommonName) > 0 {
ret = appendRDNs(ret, []string{n.CommonName}, oidCommonName)
}
if len(n.SerialNumber) > 0 {
ret = appendRDNs(ret, []string{n.SerialNumber}, oidSerialNumber)
}

return ret
}
Source: http://golang.org/src/pkg/crypto/x509/pkix/pkix.go?#L127

I would like to make the order of the pkix.Name more flexible, any ideas on how we could do this without breaking the current APIs?

Thanks,

Paul

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane