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
> >
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
https://golang.org/pkg/net/http/#ServeMux says:
> Host-specific patterns take precedence over general patterns, so that a
handler might register for the two patterns "/codesearch" and
"codesearch.google.com/" without also taking over requests for
"http://www.google.com/";.
1. "/codesearch
The following code serves the files inside ./data directory on
localhost:8080/:
log.Fatal(http.ListenAndServe(":8080",
http.FileServer(http.Dir("./data"
The following code does the same:
http.Handle("/", http.FileServer(http.Dir("./data")))
log.Fatal(http.ListenAndServe(":8080", nil))
T
rite
> code that acts like that's true and never see a problem -- but the
> reality of the implementation is that right now it is possible to
> tight-loop and block other goroutines.
>
> -Ian
>
> Quoting Jingguo Yao (2019-02-22 03:31:55)
> >Yes, my fault. Than
count)
// goroutine 1
go func() {
for {
}
}()
// goroutine 2
go func() {
for {
}
}()
time.Sleep(10 * time.Second)
}
Can goroutine 1 or goroutine 2 be preempted? If yes, by which
mechanism?
On Friday, February 22, 2019 at 4:20:12 PM UTC+8, Ian Denhardt wrote:
>
> Quoting Jingguo Yao (2019
Consider the following code which launches two goroutines. Each
goroutine uses a for loop to print messages.
package main
import (
"fmt"
"runtime"
"time"
)
func main() {
count := runtime.GOMAXPROCS(1)
fmt.Printf("GOMAXPROCS: %d\n", count)
// goroutine 1
go func() {
for
https://blog.golang.org/context uses the following code to cancel the
request if ctx.Done is closed before the goroutine exits:
func httpDo(ctx context.Context, req *http.Request, f func(*http.Response,
error) error) error {
// Run the HTTP request in a goroutine and pass the response to f.
Can anyone explain the meaning of " Get may choose to ignore the pool and
treat it as empty." in https://golang.org/pkg/sync/#Pool.Get?
> Get selects an arbitrary item from the Pool, removes it from the Pool,
and returns it to the caller. Get may choose to ignore the pool and treat
it as empty. Ca
Matt:
Thanks for you confirmation.
--
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.
For more options, visit
Take the following code as an example:
package main
import (
"fmt"
)
const (
First int64 = iota
Second
)
const (
One int64 = 1
Two = 2
)
func main() {
fmt.Printf("First type: %T, Second type: %T\n", First, Second)
fmt.Printf("One type: %T, Two type: %T\n", One, Two)
}
Running the
Aram:
Ok, 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/o
Aram:
Thanks for your reply. Could you point out where you find the format
information?
--
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+
Invoking https://golang.org/pkg/runtime/debug/#PrintStack produces the
following result:
goroutine 35 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/usr/local/go/src/runtime/debug/stack.go:24 +0x80
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x18
github.
14 matches
Mail list logo