[go-nuts] Re: political fundraising on golang.org!

2020-06-15 Thread Marian Kopriva
I agree with Peter's sentiment here.

On Sunday, June 14, 2020 at 3:36:38 PM UTC+2, peterGo wrote:
>
> Recently, a political message with a fundraising link appeared as a banner 
> atop golang.org websites: https://golang.org/, https://pkg.go.dev/.
>
> content/static: add Black Lives Matter banner to top of site
> https://go-review.googlesource.com/c/website/+/237589
>
> 
> Black Lives Matter.
> https://support.eji.org/give/153413/#!/donation/checkout;
>target="_blank"
>rel="noopener">Support the Equal Justice Initiative.
> 
>
> How was this decision made?
>
> Go is a programming language. For political fundraising use personal 
> Twitter and Facebook accounts. 
>
> Peter
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ee6284e1-5dcc-4af6-8147-1277fba67f46o%40googlegroups.com.


Re: [go-nuts] Inspecting a function for its arguments with reflection

2017-03-20 Thread Marian Kopriva
Check out https://github.com/go-martini/martini if you're looking for some 
magic.
In case you don't find any magic there, then i'm sorry, i've havne't used 
martini myself, and am not familiar with its source, i've only heard from 
others that it's quite magicky.

-- 
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: Inspecting a function for its arguments with reflection

2017-03-20 Thread Marian Kopriva
What you're looking for is reflect.Type.NumIn()int and reflect.Type.In(i 
int) Type.
See example here https://play.golang.org/p/q1D56Abj-5


On Tuesday, March 21, 2017 at 12:01:09 AM UTC+1, Tyler Compton wrote:
>
> I'm trying to create an HTTP request router library that automatically 
> decodes parameters in the request URL and passes them as arguments to the 
> handler function. It would theoretically make something like this possible:
>
> myRouter.HandleFunc("/getPuppies/{id}", func(w http.ResponseWriter, r *
> http.Request, id string) {
> // Handle the request
> });
>
> I am aware that you can't get the name of a function's arguments. That's 
> okay with me, I can just pass the params in the order they appear. However, 
> I do need to be able to check how many arguments a function has and what 
> the types of those arguments are, so I can type assert the parameters and 
> give sane error messages when the user makes a mistake.
>
> Before you point out that this is a bad idea and that reflection is never 
> clear, I am fully aware! I'm doing this to learn about reflection in Go and 
> to see if Go can support a workflow something like Java's JAX-RS.
>

-- 
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: generic "CRUD" handlers

2016-12-25 Thread Marian Kopriva
Here's the relevant paragraph from the guide you linked to (emphasis mine):

Note how goagen generated a main.go for our app as well as a skeleton 
> controller (bottle.go). These two files are meant to help bootstrap a new 
> development, *they won’t be re-generated (by default) if already present* 
> (re-run the tool again and note how it only generates the files under the 
> app, client, tool and swagger directories this time). This behavior and 
> many other aspects are configurable via command line arguments, see the 
> goagen docs for details.
>

On Saturday, December 24, 2016 at 4:34:14 PM UTC+1, Tong Sun wrote:
>
> Wow, quite impressive. I wish I had known it earlier. 
>
> One quick question, how does goa support round-robin design? I.e., from 
> https://goa.design/learn/guide/ that I quickly peeked, it says
>
> - use goa to generate a complete implementation, including bottle.go
> - Then manually edit the bottle.go file
>
> So what would happen if I have edited the bottle.go file, but want to 
> tweak my design afterward? 
>
> Thanks
>
> On Tuesday, December 20, 2016 at 7:39:17 PM UTC-5, br...@gophertrain.com 
> wrote:
>>
>> take a look at goa and gorma: https://goa.design
>>
>> goa generates an API from your description DSL, and Gorma generates the 
>> data access layer. It uses gorm under the scenes so you'll have an easy 
>> route to migration.
>>
>> Brian
>>
>> On Tuesday, December 20, 2016 at 8:46:12 AM UTC-5, Thomas Bellembois 
>> wrote:
>>>
>>> Hello, 
>>>
>>> I have an application that define structures 
>>>
>>> type Team struct { 
>>>  ID   uint   `gorm:"primary_key"` 
>>>  Name string `json:"Name"` 
>>> } 
>>> type MailingList struct { 
>>>  ID   uint   `gorm:"primary_key"` 
>>>  Name string `json:"Name"` 
>>>  Comment string `json:"Comment"` 
>>> } 
>>> ... 
>>>
>>> and handlers to manage CRUD operations 
>>>
>>> func TeamUpdateHandler(w http.ResponseWriter, r *http.Request) 
>>> func TeamCreateHandler(w http.ResponseWriter, r *http.Request) 
>>> func TeamDeleteHandler(w http.ResponseWriter, r *http.Request) 
>>> func TeamReadHandler(w http.ResponseWriter, r *http.Request) 
>>> func MailingListUpdateHandler(w http.ResponseWriter, r *http.Request) 
>>> func MailingListCreateHandler(w http.ResponseWriter, r *http.Request) 
>>> func MailingListDeleteHandler(w http.ResponseWriter, r *http.Request) 
>>> func MailingListReadHandler(w http.ResponseWriter, r *http.Request) 
>>>
>>> Is there a way in Go to define a CRUD-like model with only 4 generic 
>>> handlers to manage this operations ? 
>>>
>>> Regards, 
>>>
>>> Thomas 
>>>
>>>

-- 
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] Packaging Test Utilities in a Project

2016-12-18 Thread Marian Kopriva
What Dave suggested should work, in your example package1, package2, 
package3 and package4 should be able to import testhelpers with `import 
"project/internal/testhelpers"`

On Sunday, December 18, 2016 at 2:48:41 PM UTC+1, Henry wrote:
>
> Where do you put this internal package in relation to the rest of the 
> packages? Is it something like this:
>
> project/
>package1/
>package2/
>package3/package4/
>internal/testhelpers/
>
> I thought internal package would only be visible to its immediate parent? 
> I want it to be usable across the packages. 
>
> 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.