[go-nuts] Mapping C pointer to BYTE to golang []byte

2017-12-13 Thread snmed
Hi all I'm trying to map a C structure to an equivalent go struct, but I bumped into a problem with a pointer to byte that is actually an array of bytes. Here is the C struct: typedef struct _CERT_CONTEXT { DWORD dwCertEncodingType; BYTE *pbCertEncoded; DWORD

Re: [go-nuts] cache for *os.File

2017-12-13 Thread Dave Cheney
Does your profiling suggest these allocations are causing latency? On Thu, Dec 14, 2017 at 5:11 PM, Vasiliy Tolstov wrote: > 2017-12-13 22:31 GMT+03:00 Dave Cheney : >> What does profiling say? Does your program spend the majority of its time >> stating

Re: [go-nuts] Inconsistent handling of permissions by os.Mkdir

2017-12-13 Thread Ian Lance Taylor
On Wed, Dec 13, 2017 at 7:57 AM, Matthijs Kooijman wrote: > >> I think the inconsistency in the handling of umask on *BSD systems is >> a bug. Please open an issue for that at https://golang.org/issue. > Ok: https://github.com/golang/go/issues/23120 > >> We've discussed in the

Re: [go-nuts] cache for *os.File

2017-12-13 Thread Vasiliy Tolstov
2017-12-13 22:31 GMT+03:00 Dave Cheney : > What does profiling say? Does your program spend the majority of its time > stating files? Do stats add a significant amount of latency to your > request/response cycle? > In my case profiling says only about memory allocations when

Re: [go-nuts] Re: Learning Go: suggestions for code review?

2017-12-13 Thread Nigel Tao
On Thu, Dec 14, 2017 at 1:44 AM, Ben Hoyt wrote: > I used the "dot" import for tokenizer so I can just use "if p.tok == COMMA" > instead of "if p.tok == tokenizer.COMMA" everywhere. As per https://golang.org/doc/effective_go.html#mixed-caps ALL_CAPS names are unusual Go style.

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread Jeff Goldberg
On Wednesday, December 13, 2017 at 5:06:01 AM UTC-6, Caleb Spare wrote: > > And in fact, Tv has already done that. You want > https://github.com/tv42/zbase32. > Yep. That solves my immediate needs. (For what it is worth, I'm playing with different ways of displaying public key fingerprints in

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread Jeff Goldberg
On Wednesday, December 13, 2017 at 5:02:40 AM UTC-6, rog wrote: > > > Looking at > http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt, > it seems that zbase32 allows the encoder and decoder to agree on the > number of bits transmitted, so if you're encoding 5 bits or less, you

[go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Compiler
tanks you. i not found complate book pdf file. you not have file?! On Wednesday, December 13, 2017 at 11:22:50 PM UTC+3:30, David Chase wrote: > > I think one of the best references to this is "BCPL: The Language and Its > Compiler". > It is shorter than the Dragon Book, accessible, historical,

[go-nuts] Re: go test/flag.NewFlagSet bug?

2017-12-13 Thread jake6502
I'm not sure how you expect the *nfs=true* case to work. The "-data=x" flag will be passed to test binary, as described in the documentation. But the test binary is not just your test code, it also contains the testing framework, which must run some variant of *flag.Parse()* in order to parse

[go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread 'David Chase' via golang-nuts
I think one of the best references to this is "BCPL: The Language and Its Compiler". It is shorter than the Dragon Book, accessible, historical, and very well written. I think you can find the PDF online (maybe, not sure). On Tuesday, December 12, 2017 at 4:03:08 PM UTC-5, Compiler wrote: > >

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Dave Cheney
The code is inside the file you referenced. That is a tar ball of the source of the bootstrap 1.4.2 compiler. -- 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

[go-nuts] cache for *os.File

2017-12-13 Thread Dave Cheney
What does profiling say? Does your program spend the majority of its time stating files? Do stats add a significant amount of latency to your request/response cycle? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Bruno Albuquerque
Oh, and the generic compiler frontend: https://go.googlesource.com/go/+/go1.4.2/src/cmd/gc/ On Wed, Dec 13, 2017 at 11:27 AM Bruno Albuquerque wrote: > Go 1.4.2 compiler and linker code for x86-64. > > https://go.googlesource.com/go/+/go1.4.2/src/cmd/6c/ >

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Bruno Albuquerque
Go 1.4.2 compiler and linker code for x86-64. https://go.googlesource.com/go/+/go1.4.2/src/cmd/6c/ https://go.googlesource.com/go/+/go1.4.2/src/cmd/6l/ On Wed, Dec 13, 2017 at 11:16 AM Compiler wrote: > please

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Compiler
please show me code of compiler , linker of go1.4.(Based on C) https://storage.googleapis.com/golang/go1.4-bootstrap-20170531.tar.gz On Wednesday, December 13, 2017 at 10:39:24 PM UTC+3:30, Bruno Albuquerque wrote: > > Here is the entry point for the compiler code: > >

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Bruno Albuquerque
Here is the entry point for the compiler code: https://go.googlesource.com/go/+/master/src/cmd/compile/ And here is the entry point for the linker code: https://go.googlesource.com/go/+/master/src/cmd/link/ Note this is all non-trivial. You do need to know how compilers/linkers work before

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Compiler
may be show me github link source file then at they is generate binary... at GOLANG sources. On Wednesday, December 13, 2017 at 10:03:27 PM UTC+3:30, Andy Balholm wrote: > > By “Machine Code” I mean that “go build” or “go install” generates an > executable file that is ready for the target

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Andy Balholm
By “Machine Code” I mean that “go build” or “go install” generates an executable file that is ready for the target operating system and CPU to run directly. On Windows, it generates a .EXE file. On Unix-like operating systems it generates a “binary executable” file (which is basically the same

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Compiler
Machine Code?! please show me github link source file then at they is generate sample binary... at GOLANG sources. On Wednesday, December 13, 2017 at 8:48:30 PM UTC+3:30, Andy Balholm wrote: > > No, the Go compiler doesn’t actually generate ASM. It generates machine > code. So it doesn’t need

Re: [go-nuts] Go Compiler How Work?!

2017-12-13 Thread Andy Balholm
No, the Go compiler doesn’t actually generate ASM. It generates machine code. So it doesn’t need the help of another compiler or assembler. Andy > On Dec 13, 2017, at 9:00 AM, Compiler wrote: > > i am undrestand compiler steps. > only have problem in code generation

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Compiler
i am undrestand compiler steps. only have problem in code generation step. so best way is this then compiler generate code is ASM. GOLANG also generate ASM. yeah? On Wednesday, December 13, 2017 at 8:27:41 PM UTC+3:30, Bruno Albuquerque wrote: > > It directly generates a binary suitable for the

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Bruno Albuquerque
It directly generates a binary suitable for the target platform, yes. Again, you do not need a C compiler to compile a Go program unless you are using CGO. On Wed, Dec 13, 2017 at 8:54 AM Compiler wrote: > please answer this. > > > On Wednesday, December 13, 2017 at

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Compiler
please answer this. On Wednesday, December 13, 2017 at 4:30:52 PM UTC+3:30, Compiler wrote: > > are you sure GoCompiler/GoLang generate ASM code for build executable file > from .go? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Inconsistent handling of permissions by os.Mkdir

2017-12-13 Thread Matthijs Kooijman
Hi Ian, > I think the inconsistency in the handling of umask on *BSD systems is > a bug. Please open an issue for that at https://golang.org/issue. Ok: https://github.com/golang/go/issues/23120 > We've discussed in the past how much to document umask in the os > package. After all, umask is a

Re: [go-nuts] Re: Learning Go: suggestions for code review?

2017-12-13 Thread Marvin Renich
* Ben Hoyt [171213 09:45]: > > One minor thing may be that instead of using os.Args, I would use the > > flag's package. > > Good call. If you like the Plan 9 convention of -short style options, the standard library's flag package is good and simple. If you want the GNU

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Volker Dobler
On Wednesday, 13 December 2017 13:40:18 UTC+1, erfang...@gmail.com wrote: > > How can write a compiler Using C as test.exe then can use from test.exe > compiler any where... so can write a input file like hello world > application and generate executable file using test.exe. > > undrestand? >

[go-nuts] cache for *os.File

2017-12-13 Thread Vasiliy Tolstov
Hi! I'm not test my question, but may be somebody already knows. Nginx for example have fd cache mostly i think for sendfile syscall , so nginx already knows that file exists and it size that needed for sendfile. If i write server what accept requests from clients and read/write to many files on

Re: [go-nuts] Inconsistent handling of permissions by os.Mkdir

2017-12-13 Thread Ian Lance Taylor
On Wed, Dec 13, 2017 at 5:46 AM, wrote: > > I just ran into some inconsistencies wrt permissions and `os.Mkdir()`, at > least on Linux. I'm not sure what part of this is actual bugs that need to > be fixed and what is a documentation bug, but let me state what I've

[go-nuts] Re: Learning Go: suggestions for code review?

2017-12-13 Thread Ben Hoyt
> Don't do relative imports (littlelang/tokenizer) or . littlelang/tokenizer > . Unless you want to run into corner cases with tools not knowing where > code is defined or if you want to confuse other developers. > > Using the full path makes it very clear where the code is, yes, if you >

[go-nuts] Re: Learning Go: suggestions for code review?

2017-12-13 Thread Ben Hoyt
Thanks! I've used the full github path (github.com/benhoyt/littlelang/tokenizer) > for my subpackages when importing them but the tradeoffs for your approach (. > "littlelang/tokenizer") isn't clear to me. > Aha, thanks, I've finally realized why using full import paths (import

[go-nuts] Re: Learning Go: suggestions for code review?

2017-12-13 Thread Diego Medina
Don't do relative imports (littlelang/tokenizer) or . littlelang/tokenizer . Unless you want to run into corner cases with tools not knowing where code is defined or if you want to confuse other developers. Using the full path makes it very clear where the code is, yes, if you move things

[go-nuts] Re: Learning Go: suggestions for code review?

2017-12-13 Thread matthewjuran
I've used the full github path (github.com/benhoyt/littlelang/tokenizer) for my subpackages when importing them but the tradeoffs for your approach (. "littlelang/tokenizer") isn't clear to me. You've put care into error handling and unit testing and the code looks maintainable as a

[go-nuts] Re: What does the 1st :8 do in -- slice := (*[1 << 30]byte)(unsafe.Pointer())[:8:8]

2017-12-13 Thread James Bardin
On Wednesday, December 13, 2017 at 8:49:07 AM UTC-5, M.P. Ardhanareeswaran wrote: > > var i uint64 = 0xdeedbeef01020304 >> >> slice := (*[1 << 30]byte)(unsafe.Pointer())[:8:8] >> >> The fist 8 is the length, and the second is capacity. See "Full Slice Expressions" specification here:

[go-nuts] What does the 1st :8 do in -- slice := (*[1 << 30]byte)(unsafe.Pointer())[:8:8]

2017-12-13 Thread asaaveri
All: I saw this example at https://play.golang.org/ in cgo. I don't understand the role of the 1st :8? I tried changing it to 0 and didn't make any difference? I will appreciate any pointers. package main > > >> import ( > > "fmt" > > "unsafe" > > ) > > >> func main() { > > var i uint64 =

[go-nuts] Inconsistent handling of permissions by os.Mkdir

2017-12-13 Thread matthijskooijman
Hi, I just ran into some inconsistencies wrt permissions and `os.Mkdir()`, at least on Linux. I'm not sure what part of this is actual bugs that need to be fixed and what is a documentation bug, but let me state what I've found. The documentation for Mkdir says: "Mkdir creates a new directory

[go-nuts] Re: How to know the age from birth date

2017-12-13 Thread artem . xife
Egon function will not handle Leap year properly comparing YearDay() You must firstly compare month then day of month On Wednesday, July 16, 2014 at 1:59:13 AM UTC+3, dashaus wrote: > > Thanks all!! > Finally, I get the function of Egon. > > Carlos, yes, i'm practice with golang. I need study

[go-nuts] python remote objects

2017-12-13 Thread Keith Brown
is it possible to analyze python remote objects in go? we have several people using it and i would like to view the calls using go. -- 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

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread John McKown
On Wed, Dec 13, 2017 at 6:53 AM, wrote: > you are tell then generate a ASM code?! this may be hard And waste of time. > > At the top of the conversation, it was said that only the C language could > write compiler without any tools/another compiler. > so why now tell

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
are you sure GoCompiler/GoLang generate ASM code for build executable file from .go? On Wednesday, December 13, 2017 at 4:23:24 PM UTC+3:30, erfang...@gmail.com wrote: > > you are tell then generate a ASM code?! this may be hard And waste of time. > > At the top of the conversation, it was said

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
you are tell then generate a ASM code?! this may be hard And waste of time. At the top of the conversation, it was said that only the C language could write compiler without any tools/another compiler. so why now tell ASM?! On Wednesday, December 13, 2017 at 4:17:05 PM UTC+3:30, Chris Hopkins

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
if you write a software then can lex and parse a input file and next AST and generate a code. so need another compiler for final compile... so your software will need another tools/compiler. On Wednesday, December 13, 2017 at 4:17:05 PM UTC+3:30, Chris Hopkins wrote: > > > > On Wednesday, 13

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Chris Hopkins
On Wednesday, 13 December 2017 12:40:18 UTC, erfang...@gmail.com wrote: > > How can write a compiler Using C as test.exe then can use from test.exe > compiler any where... so can write a input file like hello world > application and generate executable file using test.exe. > > the compiler is

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
mean a compiler like golang , then for use no need any another compiler and tools. only itself. hello.go file : package main import "fmt" func main() { fmt.Println("hello world!") } -- $ go build hello.go On Wednesday, December 13, 2017 at 4:10:18 PM UTC+3:30, erfang...@gmail.com

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Chris Hopkins
On Wednesday, 13 December 2017 12:35:17 UTC, erfang...@gmail.com wrote: > > i am not tell interpreter. > I'm not sure if you mean interpreter here in the context of interpreted language, or interpreter, someone who translates between human languages. > i am tell compiler for generate a

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
How can write a compiler Using C as test.exe then can use from test.exe compiler any where... so can write a input file like hello world application and generate executable file using test.exe. undrestand? On Wednesday, December 13, 2017 at 4:05:52 PM UTC+3:30, Chris Hopkins wrote: > > I think

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Chris Hopkins
I think we have a misunderstanding. If we don't clear up this misunderstanding then we will keep going around in circles. Not wishing to offend, this comes across as a fishing expedition not as a request for specific help; however under the assumption that this is not the case, I'll try and

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
i am not tell interpreter. i am tell compiler for generate a cross executable file. may be show me a *tutorial*/video or a sample small compiler Using C Without Assembly? On Wednesday, December 13, 2017 at 3:59:16 PM UTC+3:30, Gianguido Sorà wrote: > > The compiler does produce an executable

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Jan Mercl
On Wed, Dec 13, 2017 at 1:20 PM wrote: > Could you first answer this question? The problem is that so far no one seems to be able to understand some/most of your questions. Please try asking using more words of explanation. The added context may hopefully help others to

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Gianguido Sorà
The compiler does produce an executable without any C involved. Il 13 dic 2017 13:20, ha scritto: Could you first answer this question? They question may also be answered. *how can make a new compiler programming language using c without assembly?(a compiler then can

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
Could you first answer this question? They question may also be answered. *how can make a new compiler programming language using c without assembly?(a compiler then can produce executable file) ??* On Wednesday, December 13, 2017 at 3:40:05 PM UTC+3:30, Chris Hopkins wrote: > > Before I answer

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Chris Hopkins
Before I answer anything else, I don't understand what you are saying with: On Wednesday, 13 December 2017 11:49:06 UTC, erfang...@gmail.com wrote: > > i want research about gocompiler and want recompile main go-compiler in > gnu/linux operation system.(ubuntu/arch) > not recompile golang. > To

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
*how can make a new compiler programming language using c without assembly?(a compiler then can produce executable file) ??* On Wednesday, December 13, 2017 at 3:19:58 PM UTC+3:30, Chris Hopkins wrote: > > You keep asking the same question, I think we have a misunderstanding > here. To grossly

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Chris Hopkins
You keep asking the same question, I think we have a misunderstanding here. To grossly simplify: Way back when, the first C compilers were written in Assembly. Then someone produced a C compiler that was written in C. Now you use a C compiler to build a C compiler. Some time ago the go

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
i want research about gocompiler and want recompile main go-compiler in gnu/linux operation system.(ubuntu/arch) not recompile golang. On Wednesday, December 13, 2017 at 3:13:22 PM UTC+3:30, Jérôme Champion wrote: > > I think it would be better if you explain what you want to do. > > As

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
now i am have question about golang/go-compiler work. On Wednesday, December 13, 2017 at 3:13:22 PM UTC+3:30, Jérôme Champion wrote: > > I think it would be better if you explain what you want to do. > > As example : "I want to compile a go program on a ppc64 architecture with > operating

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread Jérôme Champion
I think it would be better if you explain what you want to do. As example : "I want to compile a go program on a ppc64 architecture with operating system XY version Z." Le mercredi 13 décembre 2017 12:30:53 UTC+1, erfang...@gmail.com a écrit : > > ?!! how may be? > a software , for this then

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
for compile a test,hello world application (.go file) with golang. alwayse need cgo compiler or c compiler? cgo compiler only generate c file. not generate binary executable file. like https://github.com/xlab/c-for-go On Wednesday, December 13, 2017 at 4:41:24 AM UTC+3:30, Bruno Albuquerque

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
?!! how may be? a software , for this then generate a binary file. need Asm or Assembler or another Compiler. if gocompiler not use c-compiler for generate binary file.(for a test hello world golang appliaction) so GoCompiler how generate binary file for any platform?! may be explain me

Re: [go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
i am want test Main Go Compiler. and check and test compilers. not GoLang. On Wednesday, December 13, 2017 at 4:41:02 AM UTC+3:30, Bruno Albuquerque wrote: > > Why do you want to explicitly use an old go version? Why not 1.9.2? > > You can find pre-compiled packages for various platforms here:

[go-nuts] Re: Go Compiler How Work?!

2017-12-13 Thread erfangnulinux
in GO 1.4 , grammer/lexer is write at GO or C or both? On Wednesday, December 13, 2017 at 3:43:00 AM UTC+3:30, Dave Cheney wrote: > > In all the supported versions of Go, that is Go 1.9 and soon Go 1.10, the > grammar is written in Go. You will find the source here >

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread Caleb Spare
And in fact, Tv has already done that. You want https://github.com/tv42/zbase32. On Wed, Dec 13, 2017 at 3:01 AM, roger peppe wrote: > On 13 December 2017 at 01:23, Ian Lance Taylor wrote: >> On Tue, Dec 12, 2017 at 3:13 PM, Jeffrey Goldberg

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread roger peppe
On 13 December 2017 at 01:23, Ian Lance Taylor wrote: > On Tue, Dec 12, 2017 at 3:13 PM, Jeffrey Goldberg wrote: >> >>> On Dec 12, 2017, at 9:00 AM, Ian Lance Taylor wrote: >> >>> DecodedLen is supposed to be applied to the length of the

Re: [go-nuts] Unused Variable Generates No Error

2017-12-13 Thread dc0d
Thanks for the reply. Already done that: https://github.com/golang/go/issues/23116 On Wednesday, December 13, 2017 at 2:15:25 PM UTC+3:30, rog wrote: > > On 13 December 2017 at 09:13, Jan Mercl <0xj...@gmail.com > > wrote: > > On Wed, Dec 13, 2017 at 10:04 AM dc0d >

[go-nuts] Re: [ANN] astideepspeech: Golang bindings for Mozilla's DeepSpeech speech-to-text library

2017-12-13 Thread Ron Evans
That is a great idea, I personally will check it out for sure. On Tuesday, December 12, 2017 at 9:02:00 AM UTC+1, Asticode wrote: > > Hey guys, > > I'm happy to announce astideepspeech > , Golang bindings for > Mozilla's DeepSpeech speech-to-text

Re: [go-nuts] Unused Variable Generates No Error

2017-12-13 Thread roger peppe
On 13 December 2017 at 09:13, Jan Mercl <0xj...@gmail.com> wrote: > On Wed, Dec 13, 2017 at 10:04 AM dc0d wrote: > >> This code compiles and generates no errors. Why? > > It's legal code according to the language specification. To be fair, so is every other Go program

Re: [go-nuts] Unused Variable Generates No Error

2017-12-13 Thread Jan Mercl
On Wed, Dec 13, 2017 at 10:04 AM dc0d wrote: > This code compiles and generates no errors. Why? It's legal code according to the language specification. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Unused Variable Generates No Error

2017-12-13 Thread dc0d
This code compiles and generates no errors. Why? func f(v interface{}) { switch x := v.(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