英文:
Getting syslog.Writer undefined
问题
我已经创建了以下类似的自定义类型。
import (
"encoding/json"
"log"
"log/syslog"
"strconv"
"time"
)
type MyLogger struct {
w *syslog.Writer
LogName string
}
我遇到了syslog.Writer
未定义的错误。即使我在Go Playground中尝试了相同的代码,也会出现相同的错误。
英文:
I have created the custom type with like following.
import (
"encoding/json"
"log"
"log/syslog"
"strconv"
"time"
)
type MyLogger struct {
w *syslog.Writer
LogName string
}
And I'm getting error syslog.writer undefined. Even I tried the same in golang play ground and its giving same error.
答案1
得分: 6
根据https://blog.golang.org/playground,
为了将用户程序与Google的基础设施隔离开来,后端在Native Client(或“NaCl”)下运行它们。
而根据https://golang.org/pkg/log/syslog/,
此包在Windows上未实现。由于syslog包已经冻结,鼓励Windows用户使用标准库之外的包。有关背景,请参阅https://golang.org/issue/1108。
此包在Plan 9上未实现。
此包在NaCl(Native Client)上未实现。
你正在使用Windows,而Go Playground正在使用NaCl,这两者都没有实现syslog。
英文:
According to https://blog.golang.org/playground,
> To isolate user programs from Google's infrastructure, the back end runs them under Native Client (or "NaCl")
And from the https://golang.org/pkg/log/syslog/
> This package is not implemented on Windows. As the syslog package is frozen, Windows users are encouraged to use a package outside of the standard library. For background, see https://golang.org/issue/1108.
>
> This package is not implemented on Plan 9.
>
> This package is not implemented on NaCl (Native Client).
You are using Windows, and Go Playground is using NaCl, which both syslog is not implemented.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论