AW: [go-nuts] Using Mysql and Golang combined resources

2020-09-15 Thread Lutz Horn
The net contains many sources for this kind of information. Just a random pick: https://medium.com/@hugo.bjarred/mysql-and-golang-ea0d620574d2 Von: golang-nuts@googlegroups.com im Auftrag von Ayush Paudel Gesendet: Montag, 14. September 2020 13:11 An:

AW: [go-nuts] Re: The latest version of package in pkg.go.dev

2020-08-15 Thread Lutz Horn
Take a look at this: https://gist.github.com/loisaidasam/b1e6879f3deb495c22cc Von: Tong Sun Gesendet: ‎15.‎08.‎2020 17:51 An: golang-nuts Cc: seank...@gmail.com Betreff:

Re: [go-nuts] Is it possible to interpose exported functions.

2020-08-07 Thread Lutz Horn
Am 07.08.20 um 09:05 schrieb Yonatan Gizachew: //export Test func Test() { fmt.Println("test code") } Yes, now `Test` is exported. Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] Is it possible to interpose exported functions.

2020-08-07 Thread Lutz Horn
Am 07.08.20 um 05:00 schrieb emeg...@gmail.com: //export test func test() { fmt.Println("test code") } `test` is not exported. It would be, if it was called `Test` with a capital `T`. Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] template

2020-07-22 Thread Lutz Horn
I am running a website for which we use templates. Do you use https://golang.org/pkg/html/template/? If yes, how do you use them? If no, this question is off-topic for this mailing list. Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

AW: [go-nuts] where is temp file created by http server

2020-07-16 Thread Lutz Horn
See the documentation of `os.TempDir` at https://golang.org/pkg/os/#TempDir > On Windows, it uses GetTempPath, returning the first non-empty value from > %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory. Lutz Von: golang-nuts@googlegroups.com im

AW: [go-nuts] ignore json tag for field list in a struct field

2020-07-03 Thread Lutz Horn
This code throws an error: ./prog.go:10:10: struct field Field2 repeats json tag "field_1" also at prog.go:10 see https://play.golang.org/p/sFZ-6GWUO0J Why not use this: type a_1_struct_name struct { Field1 string `json:"field_1"` Field2 string `json:"field_2"` }

Re: [go-nuts] A modest format suggestion

2020-04-25 Thread Lutz Horn
Instead of this: | // Great is a really great function.     func Great(         anArg int,// This explains anArg         anotherArg string,// This explains anotherArg )(err error){ ... | I'd think that this: | // Great is a really great function.     func Great(         anArg int,// This

Re: [go-nuts] Understind how to apply timeout using gouritine

2020-02-24 Thread Lutz Horn
> I've tried to adapt from from "Concurrency in Go by Katherine Cox-Buday" to > understand how to apply timeout. But I don't get it. What are you trying to do? What is the expected behaviour, what happens instead? BTW, this code does not compile, there are same unbalanced curly brackets. Lutz

Re: [go-nuts] Why Discord is switching from Go to Rust

2020-02-07 Thread Lutz Horn
> "Remarkably, we had only put very basic thought into optimization as the Rust > version was written. Even with just basic optimization, Rust was able to > outperform the hyper hand-tuned Go version. This is a huge testament to how > easy it is to write efficient programs with Rust compared to

AW: [go-nuts] JSON: Having trouble parsing map keys with dots like {"foo.bar":"baz"}

2020-01-28 Thread Lutz Horn
Remove the blank in ``json: "baz.bar"` and make it `json:"baz.bar"`. This works: https://play.golang.com/p/i9SURYgGO66 Von: golang-nuts@googlegroups.com im Auftrag von m...@markhansen.co.nz Gesendet: Dienstag, 28. Januar 2020 12:14 An: golang-nuts

AW: [go-nuts] go modules and internal packages

2020-01-27 Thread Lutz Horn
Take a look at these blog articles: https://blog.golang.org/using-go-modules https://blog.golang.org/migrating-to-go-modules Lutz Von: golang-nuts@googlegroups.com im Auftrag von R Srinivasan Gesendet: Dienstag, 28. Januar 2020 00:29 An: golang-nuts

[go-nuts] AW: About go-playground

2020-01-21 Thread Lutz Horn
Note that `now := time.Now().Local()` on the playground always is `2009-11-10 23:00:00 + UTCZ`. Your loop works correctly and ends with `[2009-11-09 2009-11-16]`. Try to run it locally and see. Lutz Von: golang-nuts@googlegroups.com im Auftrag von

AW: [go-nuts] Sybase SQLAnywhere driver for Unix systems

2020-01-07 Thread Lutz Horn
If there is none listed on https://github.com/avelino/awesome-go#database-drivers or https://github.com/golang/go/wiki/SQLDrivers you are out of luck. Lutz Von: golang-nuts@googlegroups.com im Auftrag von reda laanait Gesendet: Dienstag, 7. Januar

AW: [go-nuts] MarshalJSON() output encrypted json

2019-12-27 Thread Lutz Horn
The string "my custom encryption stuff" is not valid JSON. Why does your type implement MarshalJSON if it does not produce JSON? Lutz Von: Gert Gesendet: ‎27.‎12.‎2019 07:55 An: golang-nuts

AW: [go-nuts] Not able to connect with mysql database

2019-10-11 Thread Lutz Horn
Does the user 'root' have the permission to access the database on the MySQL server running on 'localhost'? Note that this is not a Go problem but a MySQL problem. You should try to access the database using the mysql command line client berfore using it in an application. Lutz

Re: [go-nuts] How to print arrays with commas and brackets

2019-10-09 Thread Lutz Horn
I tried to print array with brackets and commas in golang. I want to get array like this. ["record1", "record2". "record3"] Encode the array to JSON: ``` package main import ( "encoding/json" "fmt" "log" "os" ) func main() { strings :=

Re: [go-nuts] Golang library for - ORM & Schema Migration

2019-09-28 Thread Lutz Horn
alex.besogo...@gmail.com: But the main issue is that Go SQL interface SUCKS. It's verbose, hard to use and is difficult to integrate with additional tooling (try adding generic tracing support, I dare you!). So often your SQL code is hidden in reams of wrapper code that sets arguments and

Re: [go-nuts] Golang library for - ORM & Schema Migration

2019-09-27 Thread Lutz Horn
On Fri, Sep 27, 2019 at 05:34:28PM +0700, Dimas Prawira wrote: > Many Gophers don't like ORM as : Just to emphasize this point: https://korban.net/posts/postgres/2017-11-02-the-case-against-orms/ Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Basic Data structures and Algorithms with Go

2019-02-11 Thread Lutz Horn
The first chapter of my book from packt is available on golangweekly. Book Title: "Basic Data structures and Algorithms with Go". Some quick observations: The code indention of many code snippets is broken. Example: https://i.postimg.cc/6QFyMVjr/twic-Value.png The terminal windows are

Re: [go-nuts] Help- Empty request header and body

2019-02-11 Thread Lutz Horn
Am new in golang and am trying to write an API but my request header and body is always empty. Well, that's a *lot* of code. Please trim it so it forms a SSCCE (http://www.sscce.org/). Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

Re: [go-nuts] Enumerate query result fields using "github.com/go-ole/go-ole/oleutil"

2019-02-11 Thread Lutz Horn
Any ideas on how I can get a list of fields (not values) after executing something like this? Try these: * https://golang.org/pkg/database/sql/#Rows.Columns * https://golang.org/pkg/database/sql/#Rows.ColumnTypes These methods give you information about the columns of a sql.Row. Lutz --

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-02-01 Thread Lutz Horn
So your example may be unexpected behavior (or bug) of lib/pq. Please file an issue report on lib/pq. Done: https://github.com/lib/pq/issues/828 Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-02-01 Thread Lutz Horn
After reading Lutz's sample code. I found lib/pq has different semantics. I'm not sure which is the right semantics, intended by database/sql APIs. That's interesting! Does the code of NextResultSet from sql.go shed any light on this?

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-01-31 Thread Lutz Horn
Then why this method is not works as expected using github.com/go-sql-driver/mysql for MySQL. It would have helped me if you'd have mentioned MySQL in your question. Your question was incomplete. Please take alook at http://www.catb.org/esr/faqs/smart-questions.html Take a look at this:

Re: [go-nuts] How to do for inserting input data(http request post method) into postgresql database

2019-01-31 Thread Lutz Horn
I used net/http package to build up the http server with golang. Also,I make the simple Html page for front end . But I don't know how to do for inserting input data(http request post method) into postgresql database ? Any one could provide the sample code ? This may not be the best Go code

Re: [go-nuts] database/sql: NextResultSet API always return false

2019-01-31 Thread Lutz Horn
Hi, I just want to know in which case NextResultSet return true? This method works as expected using github.com/lib/pq for PostgreSQL. Take a lookt at this: https://gist.github.com/lutzhorn/1aa7de538d1edd0b3904799b5bb972fd The

Re: [go-nuts] Some problem I heard in my class: there are n chess players and they play with all others 1 game and no more than 1 game per day.

2019-01-26 Thread Lutz Horn
Hi Anca, Am 26.01.19 um 09:27 schrieb Anca Emanuel: > How do you make an planing for that event ? > > Here is my > implementation: > https://github.com/ancaemanuel/comb/blob/master/chess_tournament.go > > This was not an easy problem. After some years of thinking an pencil work I > have an

AW: [go-nuts] How to change the GBK with golang default charset?

2018-05-03 Thread Lutz Horn
What do you mean by "change the GBK"? Do you want to use GBK? For what: input, output? Lutz -- 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

AW: [go-nuts] Go could really use a while statement

2018-05-02 Thread Lutz Horn
> No, I meant a while { ... } loop for foo > 1 { } is exactly what you are looking for. You can even write for true { } to get an infinite loop you will have to break from. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

AW: [go-nuts] Licensing terms when using Go code

2018-05-02 Thread Lutz Horn
Go is BSD licensed (https://golang.org/LICENSE). This is an easy license: > Copyright (c) 2009 The Go Authors. All rights reserved. > > Redistribution and use in source and binary forms, with or without > modification, are permitted provided that the following conditions are met: > > *

AW: [go-nuts] Question about int inside json

2018-04-29 Thread Lutz Horn
Use `int64` instad of `int`. https://play.golang.com/p/j10cDz7z-N0 Von: golang-nuts@googlegroups.com im Auftrag von pick...@kamelos.org Gesendet: Samstag, 28. April 2018 20:04 An: golang-nuts Betreff:

Re: [go-nuts] Update golang version

2018-03-25 Thread Lutz Horn
> How to update golang version to 1.10 via windows 10? Download the installer from https://dl.google.com/go/go1.10.windows-amd64.msi and execute it. It will discover the existing version and upgrade it. Lutz -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Known unknown escape sequence in Go

2018-03-23 Thread Lutz Horn
> I'm trying with simple Perl character class regular expression, which > should be supported by Go (link) [...] > and I found that `*\w*` or `*\S*` Perl character class are not supported. You must escape the backslash as '\\w' etc: https://play.golang.org/p/EEudvWCX_i6 Lutz -- You

Re: [go-nuts] The result of yaml.Unmarshal() is different between osX and linux

2018-03-16 Thread Lutz Horn
package main import ( "fmt" "io/ioutil" "os" yaml "gopkg.in/yaml.v2" ) type [...] This is hard to read. Please post your code with proper line breaks. Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] How to integrate ckeditor and ckfinder for golang website ?

2018-03-08 Thread Lutz Horn
I'm designing a golang website, You need to integrate ckeditor and ckfinder for your website. Thank you very much. Do you mean the tools provided by https://ckeditor.com/? You integrate them into your web site by following the documentation of these products: *

Re: [go-nuts] General question: complex search form and query params

2018-03-02 Thread Lutz Horn
Nowadays I suppose best way to do something like this is using GraphQL (for ex. https://github.com/graphql-go/graphql). But GraphQL != SQL. Building SQL from HTTP query parameters is not made more simple and secure by building GraphQL from HTTP query parameters. Lutz -- You received this

Re: [go-nuts] interface question

2018-03-02 Thread Lutz Horn
How can i get a list about which interface is implemented by this struct methods? (Because in Go there is no explicit interface declaration.) os.Open returns an os.File (https://golang.org/pkg/os/#Open). os.File (https://golang.org/pkg/os/#File) has functions and methods listed in the index

Re: [go-nuts] Go misfeature?

2017-10-25 Thread Lutz Horn
This prints "foo=2" which surprised me because I was unaware that T1 had got another foo via T3 (with less composition depth). If I put T4 directly into T1, Go would detect the ambiguity of t1.foo (because the composition depth is the same). There is no ambiguity because `T4.foo` is not

Re: [go-nuts] Why isn't golang input and output is buffered?

2017-08-30 Thread Lutz Horn
For those types of problems where i need to take large amounts of input, It's taking long time to just take input than to do processing. Can you provide example code for how you read the input? Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Upload File Size Limit in Go 1.9

2017-08-30 Thread Lutz Horn
Limiting is done by the form parse: https://golang.org/pkg/net/http/#Request.ParseMultipartForm No, this is not limiting: The whole request body is parsed and up to a total of maxMemory bytes of its file parts are stored in memory, with the remainder stored on disk in temporary files.

Re: [go-nuts] Upload File Size Limit in Go 1.9

2017-08-30 Thread Lutz Horn
Am 29.08.2017 um 21:40 schrieb Andrew: Go 1.9 has "The new |FileHeader.Size| field describes the size of a file in a multipart message." Suppose I upload multiple files using *multiple*> Can I use FileHeader.Size to limit *each*

Re: [go-nuts] Simple url shortener service

2017-08-24 Thread Lutz Horn
Hi, Am 23.08.2017 um 23:12 schrieb doug...@cornershopapp.com: i have created a simple url shortener service, for practice and learn with go, what do you think ! https://github.com/douglasmakey/ursho It looks like implementing an URL shortener is a natural choice for wetting your toes with

Re: [go-nuts] XML newline escaping

2017-08-15 Thread Lutz Horn
Hi, Am 15.08.17 um 08:31 schrieb patrickjtray...@gmail.com: > I simply want the XML files my program outputs to not have newline > characters escaped into . My input XML files contain newlines and I > want to preserve them. The is the XML entity for LF. This is correct XML which contains

Re: [go-nuts] A humble request/challenge

2017-08-09 Thread Lutz Horn
Hi Jabari, Am 08.08.2017 22:18 schrieb Jabari Zakiya: Here's a link to read and download the paper: Was your paper published in some scientific journal? You've asked similar questions already[0]. How may replies did you get so far? Did anybody implement your algorithm in any other language

Re: [go-nuts] Using bash to source a python environment

2017-06-16 Thread Lutz Horn
Hi, cmd := exec.Command("/bin/sh", "-c", ". /path to python environment/bin/activate") but actually yhe environment is not activated How do you check this? What do you want to do *after* this call to exec.Command? Lutz -- You received this message because you are subscribed to the Google

[go-nuts] CoC WG members from outside the USA?

2017-06-16 Thread Lutz Horn
Hi, https://github.com/golang/proposal/blob/master/design/13073-code-of-conduct.md#open-issues says: The Working Group does not yet include anyone from Asia, Europe, or Africa. In particular, Europe and China are home to a large swath of Go users, so it would be valuable to include some

Re: [go-nuts] goxpath: An XPath 1.0 parser

2017-06-14 Thread Lutz Horn
Hi, Am 14.06.2017 15:57 schrieb seamus via golang-nuts: Yes referring to https://github.com/ChrisTrenkamp/goxpath ... You would be Chris Trenkamp. Then you will probably get better answers if you open an issue on this GitHub project. The people here on go-nuts did not write this library nor

Re: [go-nuts] goxpath: An XPath 1.0 parser

2017-06-14 Thread Lutz Horn
Hi, I've been doing some work on goxpath to use it to evaluate xpath expressions used in YANG. One issue I just hit is the XSLT current() function is used in the YANG files, this fails to evaluate as current() isn't included in the implementation. Did you consider it at all ? * Are you

Re: [go-nuts] Create methods for structs at runtime

2017-06-14 Thread Lutz Horn
Hi, Given an interface, how can I create a struct instance with the methods of the interface at runtime? What is your usecase for this? What problem are you trying to solve? Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] beginner seeks peer review

2017-05-17 Thread Lutz Horn
Hi, the more I work with Go the more I like it. Reading code written by other people, even by beginners, is straight forward. https://github.com/kbfastcat/nrmetrics go_vet and the misspell check found some minor issues: https://goreportcard.com/report/github.com/kbfastcat/nrmetrics My

[go-nuts] Re: Feedback welcome: "Shorten your URL"

2017-05-02 Thread Lutz Horn
Hi, To serve static files, you can use one of the many pre defined go http handlers, fs := http.FileServer(http.Dir("static")) http.Handle("/", fs) found this article, among many others, http://www.alexedwards.net/blog/serving-static-sites-with-go Yes, that's a good point. Reading the

[go-nuts] Re: Feedback welcome: "Shorten your URL"

2017-05-02 Thread Lutz Horn
Hi Val, I'll go with 2 remarks and leave other concerns to other reviewers : - using ioutil.ReadFile to serve some static html isn't the most idiomatic. Have a look at html/template . I had a vague feeling that this should be easier :) Thanks, I'll

[go-nuts] Feedback welcome: "Shorten your URL"

2017-05-02 Thread Lutz Horn
Hi Go Nuts, to practice my Go skills, I've implemented a simple web application that allows you to shorten an URL. The application consists of a backend written in Go and a web frontend using jQuery with some plugins and Bootstrap for layout. The code is available on GitHub at

Re: [go-nuts] master to slave communication - design suggestions

2017-04-26 Thread Lutz Horn
> I am working on building a distributed system where a bunch of > workers (can scale to few thousands) are connected to a manager. > Workers send certain local events to the manager and the manager then > should broadcast that event to all other workers. Workers shouldn't > miss any event (for