我很难从用 Go 编写的 lambda 函数中获取当前的 Cognito 用户属性。我目前正在做:
userAttributes = request.RequestContext.Authorizer["claims"]
Run Code Online (Sandbox Code Playgroud)
如果我想收到电子邮件:
userEmail = request.RequestContext.Authorizer["claims"].(map[string]interface{})["email"].(string)
Run Code Online (Sandbox Code Playgroud)
我不认为这是一个好方法,甚至不是一个可以接受的方法——它必须有更好的方法来做到这一点。
下面两个例子有什么区别吗?
type Example struct {}
func main() {
e := Example{}
}
Run Code Online (Sandbox Code Playgroud)
对比
type Example struct {}
func main() {
var e Example
}
Run Code Online (Sandbox Code Playgroud)
有更好的吗?
谢谢!
我正在尝试执行以下操作:
size=$(curl -sI "https://stackoverflow.com/posts/0/editor-heartbeat/ask" | grep -i Content-Length | awk '{print $2}')
echo $((size / 3))
Run Code Online (Sandbox Code Playgroud)
但是这会返回错误:
")syntax error: invalid arithmetic operator (error token is "
Run Code Online (Sandbox Code Playgroud)
我想这与awk的结果有关.
先感谢您.