add a README note about the known issues for Go inside code editors/IDEs

Former-commit-id: a4be78e746f5675291bab5a1b3e62eaf42cbd98c
This commit is contained in:
Gerasimos (Makis) Maropoulos 2018-08-02 01:58:46 +03:00
parent 2b72aadb15
commit d98da25ffb
3 changed files with 27 additions and 3 deletions

View File

@ -33,6 +33,25 @@ _Updated at: [Tuesday, 21 November 2017](_benchmarks/README_UNIX.md)_
</details>
<details>
<summary>Known issues for code editors and IDEs at general</summary>
### VS Code
For some reason the latest [vscode-go language extension](https://github.com/Microsoft/vscode-go) does not provide enough intelligence for the `iris.Context` type alias (input parameters documentation and definition navigation).
Probably you have already experienced this issue with other Go libraries too, it is not an iris-specific issue, it is a general issue for all Golang type aliases.
Therefore if you use [VS Code](https://code.visualstudio.com/) and you need these editor's features, import the original path; add an extra import statement of the original path of the `Context`, that will do it:
```go
import (
"github.com/kataras/iris"
"github.com/kataras/iris/context" // <- HERE
)
```
</details>
## Philosophy
The Iris philosophy is to provide robust tooling for HTTP, making it a great solution for single page applications, web sites, hybrids, or public HTTP APIs. Keep note that, so far, iris is the fastest web framework ever created in terms of performance.

View File

@ -10,7 +10,12 @@ import (
"time"
"github.com/kataras/golog"
"github.com/kataras/iris"
// Note:
// For some reason the latest vscode-go language extension does not provide enough intelligence (parameters documentation and go to definition features)
// for the `iris.Context` alias, therefore if you use VS Code, import the original import path of the `Context`, that will do it:
"github.com/kataras/iris/context"
)
// A Broker holds open client connections,
@ -73,7 +78,7 @@ func (b *Broker) listen() {
}
}
func (b *Broker) ServeHTTP(ctx iris.Context) {
func (b *Broker) ServeHTTP(ctx context.Context) {
// Make sure that the writer supports flushing.
//
flusher, ok := ctx.ResponseWriter().(http.Flusher)
@ -84,7 +89,7 @@ func (b *Broker) ServeHTTP(ctx iris.Context) {
}
// Set the headers related to event streaming, you can omit the "application/json" if you send plain text.
// If you developer a go client, you must have: "Accept" : "application/json, text/event-stream" header as well.
// If you develop a go client, you must have: "Accept" : "application/json, text/event-stream" header as well.
ctx.ContentType("application/json, text/event-stream")
ctx.Header("Cache-Control", "no-cache")
ctx.Header("Connection", "keep-alive")

View File

@ -12,6 +12,6 @@
</script>
</head>
<body>
<h1>Open the browser's console(F12) and watch for icoming event messages</h1>
<h1>Open the browser's console(F12) and watch for incoming event messages</h1>
</body>
</html>