[go-nuts] Type safe and modularize way to generate html on server side.

2019-05-08 Thread Felix Sun
https://github.com/theplant/htmlgo

A few benefits with this approach than html/template

- Compiled type safe
- Fast as go itself
- Not possible to generate unmatched html tags
- No need to manage template files, and caring about it's path etc
- Easier to modularize, any component can be purely funcs

-- 
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/CADdyq2x9Cdv2da8-Mm4EuYbC50vbtBzNXsiX8YBETLY1-R5SvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Is uint(v) when v is minus because a huge number supposed behavior?

2017-02-26 Thread Felix Sun
Thank you for the clarification.
Axel Wagner <axel.wagner...@googlemail.com>于2017年2月27日 周一上午8:43写道:

> Because v := -1 declares a new variable and saves it in v - and the
> default type of an integer constant is int. After that, this int gets
> converted to a uint, which is fine.
> In the case of uint(-1), you have an untyped constant, which you then try
> to cast directly to a specific type (making a typed constant). But a
> uint-constant can't be -1.
>
> So, there are two differences: one is between a constant and a variable
> (for example, uint(int(-1)) also doesn't work, as you are still making a
> constant) and two, between casting an int to a uint and trying to create a
> negative uint const.
>
> On Mon, Feb 27, 2017 at 12:16 AM, Felix Sun <sunf...@gmail.com> wrote:
>
> But why these two way don't have consistent behavior ?
>
> uint(-1)
>
>
> v :=-1
> uint(v)
>
>
> Michael Jones <michael.jo...@gmail.com>于2017年2月26日 周日上午11:35写道:
>
> yes.
> https://en.wikipedia.org/wiki/Two's_complement
>
> On Sat, Feb 25, 2017 at 10:21 PM, Felix Sun <sunf...@gmail.com> wrote:
>
> https://play.golang.org/p/TmxMmltHGH
>
> package main
>
> import (
> "fmt"
> )
>
> func main() {
> var f int = -1
> fmt.Println("become huge number:", uint(f))
> fmt.Println("this panic", uint(-1))
>
> }
>
> --
> 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.
>
>
>
>
> --
> Michael T. Jones
> michael.jo...@gmail.com
>
> --
> 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] Is uint(v) when v is minus because a huge number supposed behavior?

2017-02-26 Thread Felix Sun
But why these two way don't have consistent behavior ?

uint(-1)


v :=-1
uint(v)


Michael Jones <michael.jo...@gmail.com>于2017年2月26日 周日上午11:35写道:

> yes.
> https://en.wikipedia.org/wiki/Two's_complement
>
> On Sat, Feb 25, 2017 at 10:21 PM, Felix Sun <sunf...@gmail.com> wrote:
>
> https://play.golang.org/p/TmxMmltHGH
>
> package main
>
> import (
> "fmt"
> )
>
> func main() {
> var f int = -1
> fmt.Println("become huge number:", uint(f))
> fmt.Println("this panic", uint(-1))
>
> }
>
> --
> 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.
>
>
>
>
> --
> Michael T. Jones
> michael.jo...@gmail.com
>

-- 
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] Is uint(v) when v is minus because a huge number supposed behavior?

2017-02-25 Thread Felix Sun
https://play.golang.org/p/TmxMmltHGH

package main

import (
"fmt"
)

func main() {
var f int = -1
fmt.Println("become huge number:", uint(f))
fmt.Println("this panic", uint(-1))

}

-- 
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 get an element from []interface{} `arr[0] == nil` is not true?

2017-02-15 Thread Felix Sun
https://play.golang.org/p/qYA8Ddnnye

```

package main

import (
"fmt"
)

type Obj struct {
One *Obj
}

func main() {
var o = {}

var arr = []interface{}{o.One}

fmt.Println(arr[0])
fmt.Println("why this is not true?", arr[0] == nil)
}


```


Why `arr[0] == nil` is not true?

-- 
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] reflectutils: Easier way to use reflect to set values in Go

2016-10-13 Thread Felix Sun
https://github.com/sunfmin/reflectutils

-- 
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.