[go-nuts] Having trouble in running a go-git api example

2022-10-12 Thread PK
Hi,
I am trying to run example provided 
here(https://github.com/go-git/go-git/tree/master/_examples)

1) firstly I run the clone example by cloning a 
repo(https://github.com/go-git/go-git/blob/master/_examples/clone/auth/basic/access_token/main.go).
 
(it was successful)

2) Then I run the commit example by creating a 
file.(https://github.com/go-git/go-git/blob/master/_examples/commit/main.go) 
it was successful.

3) Now I want to push that file to git repo. but I am not able to 
understand what argument i should give along with the go executable 
file.(https://github.com/go-git/go-git/blob/master/_examples/push/main.go)

Can anyone please help me this.
Thank you.

-- 
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/81a55c30-9282-4982-89dd-c71d673f7b34n%40googlegroups.com.


Re: [go-nuts] The effect go test -v flag on local directory mode and package list mode

2022-10-12 Thread jingguo yao
Got it.

On Thu, Oct 13, 2022 at 7:13 AM Ian Lance Taylor  wrote:

> On Tue, Oct 11, 2022 at 8:42 PM Jingguo Yao  wrote:
> >
> > I have the following directory layout:
> >
> > ├── bar
> > │   └── bar_test.go
> > ├── foo
> > │   └── foo_test.go
> > ├── go.mod
> > └── go.sum
> >
> >
> > foo_test.go:
> > package main
> >
> > import (
> > "fmt"
> > "testing"
> > )
> >
> > func TestHelloWorld(t *testing.T) {
> > fmt.Println("hello, foo")
> > t.Log("hi, foo")
> > }
> >
> > bar_test.go:
> > package bar
> >
> > import (
> > "fmt"
> > "testing"
> > )
> >
> > func TestGreeting(t *testing.T) {
> > fmt.Println("hello, bar")
> > t.Log("hi, bar")
> > }
> >
> >
> > $ go test -count=1 -v ./...
> > === RUN   TestGreeting
> > hello, bar
> > bar_test.go:10: hi, bar
> > --- PASS: TestGreeting (0.00s)
> > PASS
> > ok  yao.org/lang/bar0.814s
> > === RUN   TestHelloWorld
> > hello, foo
> > foo_test.go:10: hi, foo
> > --- PASS: TestHelloWorld (0.00s)
> > PASS
> > ok  yao.org/lang/foo0.518s
> >
> > $ go test -count=1  ./...
> > ok  yao.org/lang/bar0.115s
> > ok  yao.org/lang/foo0.210s
> >
> > foo$ go test -v -count=1
> > === RUN   TestHelloWorld
> > hello, foo
> > foo_test.go:10: hi, foo
> > --- PASS: TestHelloWorld (0.00s)
> > PASS
> > ok  yao.org/lang/foo0.271s
> >
> > foo$ go test -count=1
> > hello, foo
> > PASS
> > ok  yao.org/lang/foo0.105s
> >
> > I found the following different effects on two test modes by -v flag.
> >
> > 1. -v enables the output of fmt.Println and T.Log statements in package
> list mode.
> > 2. -v enables the output of T.Log statements in local directory mode.
> >
> > I browsed https://pkg.go.dev/cmd/go. But I failed to find a description
> of
> > this difference. Does this difference work as designed? If yes, can we
> document
> > it explicitly?
>
> I don't think we want to lock ourselves into the current behavior if
> we can avoid it.  We may find reasons to change it over time.
>
> (That said I wouldn't be surprised if changing this behavior broke
> some people's use cases.)
>
> Ian
>


-- 
Jingguo

-- 
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/CANPB7a54HMSYgoo01sQJJhAnnLKFOJwOOYcuSDt6%2BPnaYNUhEQ%40mail.gmail.com.


Re: [go-nuts] The effect go test -v flag on local directory mode and package list mode

2022-10-12 Thread Ian Lance Taylor
On Tue, Oct 11, 2022 at 8:42 PM Jingguo Yao  wrote:
>
> I have the following directory layout:
>
> ├── bar
> │   └── bar_test.go
> ├── foo
> │   └── foo_test.go
> ├── go.mod
> └── go.sum
>
>
> foo_test.go:
> package main
>
> import (
> "fmt"
> "testing"
> )
>
> func TestHelloWorld(t *testing.T) {
> fmt.Println("hello, foo")
> t.Log("hi, foo")
> }
>
> bar_test.go:
> package bar
>
> import (
> "fmt"
> "testing"
> )
>
> func TestGreeting(t *testing.T) {
> fmt.Println("hello, bar")
> t.Log("hi, bar")
> }
>
>
> $ go test -count=1 -v ./...
> === RUN   TestGreeting
> hello, bar
> bar_test.go:10: hi, bar
> --- PASS: TestGreeting (0.00s)
> PASS
> ok  yao.org/lang/bar0.814s
> === RUN   TestHelloWorld
> hello, foo
> foo_test.go:10: hi, foo
> --- PASS: TestHelloWorld (0.00s)
> PASS
> ok  yao.org/lang/foo0.518s
>
> $ go test -count=1  ./...
> ok  yao.org/lang/bar0.115s
> ok  yao.org/lang/foo0.210s
>
> foo$ go test -v -count=1
> === RUN   TestHelloWorld
> hello, foo
> foo_test.go:10: hi, foo
> --- PASS: TestHelloWorld (0.00s)
> PASS
> ok  yao.org/lang/foo0.271s
>
> foo$ go test -count=1
> hello, foo
> PASS
> ok  yao.org/lang/foo0.105s
>
> I found the following different effects on two test modes by -v flag.
>
> 1. -v enables the output of fmt.Println and T.Log statements in package list 
> mode.
> 2. -v enables the output of T.Log statements in local directory mode.
>
> I browsed https://pkg.go.dev/cmd/go. But I failed to find a description of
> this difference. Does this difference work as designed? If yes, can we 
> document
> it explicitly?

I don't think we want to lock ourselves into the current behavior if
we can avoid it.  We may find reasons to change it over time.

(That said I wouldn't be surprised if changing this behavior broke
some people's use cases.)

Ian

-- 
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/CAOyqgcWSXTRsfxdK4H-uvNNsBOki4G353hjNnegfKMkcE%2Br1ww%40mail.gmail.com.


Re: [go-nuts] CLA Signing for contributing is broken

2022-10-12 Thread Ian Lance Taylor
On Wed, Oct 12, 2022 at 9:05 AM Adrian Lungu  wrote:
>
> I've made a PR recently for the oauth2 golang repo, and stumbled into the CLA 
> part of the process. After signing the required documents, I read that we're 
> supposed to trigger a rescan, but following the link provided, I end up on a 
> page where I get:
>
> > 400. That's an error. That's all we know
>
> URL is as follows (key removed):
>
> > https://cla.developers.google.com/github/rescan?pr=golang%2foauth2%2fpull%2f572&key=...&expiry=2022-08-27
>
> Any ideas what I'm doing wrong or how we can get PRs merged in this case ? Or 
> at least alert the people responsible about this issue ?

What documentation are you reading that is telling you to do a rescan
via that URL?  Is it Go documentation or something else?  I don't see
anything about this in the Go documentation but I may be looking in
the wrong place.

What is the pull request number?

Thanks.

Ian

-- 
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/CAOyqgcX3rMeAB0Wska6OT7jOJpAnwo37i%3D8%3DuJF%2Bu%2B98OVSpeg%40mail.gmail.com.


Re: [go-nuts] How to add zero after a decimal point in float datatype

2022-10-12 Thread 'Joshua Christudoss' via golang-nuts
Use  

| %.2f     in   fmt.printf


 |

Thanks & Regards

Joshua Christudoss
In Christ | For Christ | By Christ


Sent from Yahoo Mail on Android 
 
  On Thu, 13 Oct 2022 at 1:20 am, Jan Mercl<0xj...@gmail.com> wrote:   On Wed, 
Oct 12, 2022 at 9:31 PM pravin chaudhary  wrote:

> I need to add zero after a decimal point to a float datatype but not able to 
> do.
>
> Required float value = 5.00 but getting as 5
>
> Datatype should be float only!!
>
> Any help will be much appreciated!

Is this perhaps what you're looking for? https://go.dev/play/p/LnaYYA_8VOg

-- 
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/CAA40n-WV%2BD3QCa6q%3DcUNi338-cZTBkNyUpbODHxVYZL%2BiG2G_A%40mail.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1713055413.830657.1665604581268%40mail.yahoo.com.


Re: [go-nuts] How to add zero after a decimal point in float datatype

2022-10-12 Thread Jan Mercl
On Wed, Oct 12, 2022 at 9:31 PM pravin chaudhary  wrote:

> I need to add zero after a decimal point to a float datatype but not able to 
> do.
>
> Required float value = 5.00 but getting as 5
>
> Datatype should be float only!!
>
> Any help will be much appreciated!

Is this perhaps what you're looking for? https://go.dev/play/p/LnaYYA_8VOg

-- 
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/CAA40n-WV%2BD3QCa6q%3DcUNi338-cZTBkNyUpbODHxVYZL%2BiG2G_A%40mail.gmail.com.


[go-nuts] How to add zero after a decimal point in float datatype

2022-10-12 Thread pravin chaudhary
I need to add zero after a decimal point to a float datatype but not able 
to do.

Required float value = 5.00 but getting as 5

Datatype should be float only!!

Any help will be much appreciated!

Thanks,
Pravin

-- 
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/7915d0e4-1c63-4108-9e3a-7977c3e5ab65n%40googlegroups.com.


Re: [go-nuts] Zero-sized data type

2022-10-12 Thread 'Axel Wagner' via golang-nuts
You can re-order the fields to get the desired effect:
https://go.dev/play/p/E1KTqVp0i-v

On Wed, Oct 12, 2022 at 6:01 PM Richiise Nugraha 
wrote:

> Hi, I am looking for zero-sized data type, something like Flexible Array
> Member.
> The size of `struct {}` is indeed zero, but for what reason when it's
> inside a struct with another member say (https://go.dev/play/p/DpydJIke7dS
> ):
>
> type C struct {
> Pre   uint64
> Inner struct{}
> }
>
> That struct sized for 16, while the sum of all member sizes is only 8,
> it's like there's hidden padding/align.
>
> Thanks!
> Nugraha
>
> --
> 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/2f7254a8-379a-4dc2-bf10-70ee7a209af2n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfH1HsKCqX2KRqoiWui_s7RLJim4ownVtau-T7R_-YRosQ%40mail.gmail.com.


Re: [go-nuts] Zero-sized data type

2022-10-12 Thread Jan Mercl
On Wed, Oct 12, 2022 at 6:01 PM Richiise Nugraha 
wrote:

> Hi, I am looking for zero-sized data type, something like Flexible Array
Member.
> The size of `struct {}` is indeed zero, but for what reason when it's
inside a struct with another member say (https://go.dev/play/p/DpydJIke7dS):
>
> type C struct {
> Pre   uint64
> Inner struct{}
> }
>
> That struct sized for 16, while the sum of all member sizes is only 8,
it's like there's hidden padding/align.

IINM, if the last field of a Go struct has zero size the struct is
extended by at least one byte to prevent taking the address of the
zero sized field that could be outside of the allocated memory area
for the instance of C. (That could, for example, make the precision garbage
collector consider the following memory block reachable when it is not.)

If that's the case then the definition above is actually laid out as

type C struct {
Pre uint64
Inner byte
}

Note that the flexible array member concept of C is in most cases not
compatible with memory managed
by the Go runtime as described in the documentation for package unsafe. It
should be fine in memory
not managed by the Go runtime, though.

-j

-- 
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/CAA40n-WLF1YZuT-cGyZ3JF6hyfUfKFgHiQbvGoHeoK4AuaQ9UA%40mail.gmail.com.


[go-nuts] JWT Updated and ask for advice

2022-10-12 Thread Gerardo Bustani
Hi good afternoon golang dev's, I'm starting in golang blogs and I don't 
where to post this kind of questions,

Learning fiber framework and JWT Auth I'm getting in the register Func and 
Login Func the user Id is saving correctly on DB. The cookie and JWT are 
getting correctly and disply the cookie and preseve on the frontEnd, but 
when I want to get the login UserId on Controller I got 0 did some one 
know's what is happening?

I leave the code hopping have some orientation. 

Jwt has been updated and I’m confuse.

```
// Midleware: 
const SecretKey = "secret"
func IsAuthenticated(c *fiber.Ctx) error {

cookie := c.Cookies("jwt")
token, err := jwt.ParseWithClaims(cookie, &jwt.RegisteredClaims{}, 
func(token *jwt.Token) 
   (interface{}, error) {
return []byte(SecretKey), nil
})

if err != nil || !token.Valid {

c.Status(fiber.StatusUnauthorized)

return c.JSON(fiber.Map{

"message": "unauthenticated",
})
}

 return c.Next()
}

func GetUserId(c *fiber.Ctx) (uint, error) {

 cookie := c.Cookies("jwt")

 log.Println("Cookie .: ", cookie)

 token, err := jwt.ParseWithClaims(cookie, &jwt.RegisteredClaims{}, 
func(token *jwt.Token) 

 (interface{}, error) {

return []byte(SecretKey), nil

 })
log.Println("Token .: ", token)

log.Println("Error .: ", err)

if err != nil {

return 0, err

}
// var user dto.User
// expireTime := time.Now().Add(24 * time.Hour)
// payloads := jwt.RegisteredClaims{
//  Subject:   strconv.Itoa(int(user.Id)),
//  ExpiresAt: &jwt.NumericDate{Time: expireTime},
// }

payload := token.Claims.(*jwt.RegisteredClaims)

id, _ := strconv.Atoi(payload.Subject)

return uint(id), nil
}

func GenerateJWT(id uint) (string, error) {
 expireTime := time.Now().Add(24 * time.Hour)
 var user dto.User
 token, err := jwt.NewWithClaims(jwt.SigningMethodHS256, 
 jwt.RegisteredClaims{
Subject:   strconv.Itoa(int(user.Id)),
ExpiresAt: &jwt.NumericDate{Time: expireTime},
 }).SignedString([]byte(SecretKey))
 if err != nil {
log.Println(err)
 }
 return token, err
 }
 //Controller:
 func User(c *fiber.Ctx) error {
  var user dto.User
  id, err := middlewares.GetUserId(c)
  log.Println(id)
  if err != nil {
return err
  }
  confmysql.DB.Where("id = ?", id).First(&user)
  return c.JSON(user)
}

-- 
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/f1497701-c22b-4126-86f1-60c708f22251n%40googlegroups.com.


[go-nuts] Tracking which connection is used to make an HTTP request

2022-10-12 Thread Christian Worm Mortensen
I have created an http.Client with a custom TLS dialer. The custom TLS 
dialer creates a *tls.Conn and while doing this, it logs out a lot of 
information such as which server is used. 

Now, when I make an HTTP request, I want to log out which dial produced the 
*tls.Conn the HTTP request ended up using.

Using httptrace.ClientTrace.GotConn it is possible to get the net.Conn that 
was used by the request. But how do I relate that with which dial was used 
to create it?

I see four options but they all have drawbacks:

1) I can keep a map from net.Conn to information that identifies the dial. 
But when can I delete entries from this map? Go does not have weak pointers.
 
2) I can make a my own struct and return from my custom dialer:

type myConn struct {
  net.Conn
  dialInfo string
}

However, that does not work well for TLS. The reason is that the Go HTTP 
client has special logic in case a custom dialer returns a *tls.Conn. That 
logic will be disabled.

3) I can log out the address of the net.Conn object both from my custom 
dialer and from GotConn. I can do that by using something like 
reflect.ValueOf(conn).Pointer(). However in practice it seems like 
different net.Conn objects can easily get the same address.

4) I can log out the local and remote IP addresses and port of the net.Conn 
both from the dialer and from GotConn. It is a lot of information and 
different connections may use the same IP and ports. But maybe the best I 
can do?

Any other ideas?

-- 
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/f23ba2d3-37d2-4c2e-9f5d-59c2d8797339n%40googlegroups.com.


[go-nuts] CLA Signing for contributing is broken

2022-10-12 Thread Adrian Lungu
Hello!

I've made a PR recently for the oauth2 golang repo, and stumbled into the 
CLA part of the process. After signing the required documents, I read that 
we're supposed to trigger a rescan, but following the link provided, I end 
up on a page where I get:

> 400. That's an error. That's all we know

URL is as follows (key removed):

> https://cla.developers.google.com/github/rescan?pr=golang%2foauth2%2fpull%2f572&key=...&expiry=2022-08-27

Any ideas what I'm doing wrong or how we can get PRs merged in this case ? 
Or at least alert the people responsible about this issue ?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/cfdf9ae6-6222-4fb0-948a-c037654b6f4fn%40googlegroups.com.


[go-nuts] Zero-sized data type

2022-10-12 Thread Richiise Nugraha
Hi, I am looking for zero-sized data type, something like Flexible Array 
Member.
The size of `struct {}` is indeed zero, but for what reason when it's 
inside a struct with another member say (https://go.dev/play/p/DpydJIke7dS):

type C struct {
Pre   uint64
Inner struct{}
}

That struct sized for 16, while the sum of all member sizes is only 8, it's 
like there's hidden padding/align.

Thanks!
Nugraha

-- 
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/2f7254a8-379a-4dc2-bf10-70ee7a209af2n%40googlegroups.com.


Re: [go-nuts] workspace question

2022-10-12 Thread Steve Roth
Thank you, Jan.  Apparently where I went wrong was assuming that the
dependency had to be listed in go.mod.  (i.e., using the names from your
example, foo/go.mod needed to have a "require bar" in it).  That is what I
was struggling to achieve; it never occurred to me that it could be
omitted.  I'm still surprised it works without that; it seems weird to have
a dependency on another module and *not* list it with all of the other
dependencies.

At any rate, I have it working now based on your help — much appreciated.
Steve


On Tue, Oct 11, 2022 at 11:22 PM Jan Mercl <0xj...@gmail.com> wrote:

> On Wed, Oct 12, 2022 at 4:49 AM Steve Roth  wrote:
> >
> > I'd appreciate help with setting up a workspace, involving two modules
> that exist only on my local disk and not in any SCM.  I understand how to
> create the workspace and use both modules in it.  What I can't figure out
> is how to add a dependency from mod1 to mod2 in mod1's go.mod file.
> >
> > The supported means of adding dependencies in go.mod files is the go get
> command.  But if I go into mod1's directory and run "go get path/to/mod2",
> it tries to download it from github and fails.  I cannot figure out how to
> tell go get to use the version that's on my local disk, even though the
> workspace says it should.
> >
> > Similarly, I can't figure out how to add the necessary go.mod and go.sum
> entries manually.  The documentation explicitly warns against trying to do
> so, anyway.
> >
> > It seems like this is exactly the case workspaces were designed for,
> developing two modules at once, and yet I've had no success in getting it
> set up.  Any suggestions?
>
> For example:
>
> jnml@3900x:~/tmp/modules/bar$ rm -rf *
> jnml@3900x:~/tmp/modules/bar$ go mod init example.com/bar
> go: creating new go.mod: module example.com/bar
> jnml@3900x:~/tmp/modules/bar$ echo 'package bar; func Y() {}' > bar.go
> jnml@3900x:~/tmp/modules/bar$
>
> and
>
> jnml@3900x:~/tmp/modules/foo$ rm -rf *
> jnml@3900x:~/tmp/modules/foo$ go mod init example.com/foo
> go: creating new go.mod: module example.com/foo
> jnml@3900x:~/tmp/modules/foo$ echo 'package foo; import "example.com/bar";
> func X() { bar.Y() }' > foo.go
> jnml@3900x:~/tmp/modules/foo$ go build -v
> foo.go:1:21: no required module provides package example.com/bar; to add
> it:
> go get example.com/bar
> jnml@3900x:~/tmp/modules/foo$ go work init
> jnml@3900x:~/tmp/modules/foo$ go work use ../bar
> jnml@3900x:~/tmp/modules/foo$ go build -v
> directory . is contained in a module that is not one of the workspace
> modules listed in go.work. You can add the module to the workspace using
> go work use .
> jnml@3900x:~/tmp/modules/foo$ go work use .
> jnml@3900x:~/tmp/modules/foo$ go build -v
> jnml@3900x:~/tmp/modules/foo$
>
> HTH
>
> -j
>

-- 
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/CAAnpqKFVsSXXi3qEFWhrXDGqFkxT85xJ__ZsBDnJFuDWJtELuA%40mail.gmail.com.


[go-nuts] go:embed question

2022-10-12 Thread Endre Simo (esimov)
I know that //go:embed directive reads the content of the embedable file at 
compile time. Now if that's the case I wondering if you are running a Go 
executable with "go run" at the same time while you are downloading like go 
run github.com/user/projectname@latest (which should embed an external 
file) why the file is not embedded?

Normally if the file you want to embed does not exits, the compiler will 
throw you an error telling that "no matching files found". Why is not the 
case when you are running without a prior download? 

I'm asking this because if I'm running the application normally the file is 
getting embedded correctly, but if I'm trying to build it on-the-fly with 
go run this is not happening? 

-- 
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/a6042517-5e2d-429d-acf3-7cfdfb653036n%40googlegroups.com.