小编Gia*_*Arb的帖子

json.Marshal如何体内http.newRequest

我正在努力创建一个用于管理数字海洋飞沫的小控制台,这是我第一次体验Go ..

我有这个错误

s, _ := json.Marshal(r);

// convert type

req, _ := http.NewRequest("GET", "https://api.digitalocean.com/v2/droplets", s)                                          
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))                                                          
req.Header.Set("Content-Type", "application/json")                            
response, _ := client.Do(req)
Run Code Online (Sandbox Code Playgroud)

如何为func NewRequest转换为良好类型值的s []字节?!NewRequest期望Body类型为io.Reader ..

s, _ := json.Marshal(r);

// convert type

req, _ := http.NewRequest("GET", "https://api.digitalocean.com/v2/droplets", s)                                          
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))                                                          
req.Header.Set("Content-Type", "application/json")                            
response, _ := client.Do(req)
Run Code Online (Sandbox Code Playgroud)

谢谢!

json type-conversion go

8
推荐指数
1
解决办法
1万
查看次数

Jekyll 站点仅在推送到 GitHub 时失败

我正在使用 Jekyll 开发一个新版本的静态网站,该网站通过 Github 页面部署:https : //devcampy.com

存储库:https : //github.com/gianarb/devcampy.com

我在本地使用 docker 运行它,但无法重现该问题:

$ docker run --rm -p 4000:4000 -v "$PWD":/srv/jekyll jekyll/jekyll:stable jekyll serve
Run Code Online (Sandbox Code Playgroud)

这是我推送到存储库时通过电子邮件收到的错误。我不明白为什么它不能正常工作

The page build failed for the `master` branch with the following error:

Your SCSS file `assets/main.scss` has an error on line 6: File to import not found or unreadable: vendor/rfs. Load paths: node_modules /hoosegow/.bundle/ruby/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass /hoosegow/.bundle/ruby/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass /hoosegow/.bundle/ruby/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass. For more information, see https://help.github.com/en/articles/page-build-failed-invalid-sass-or-scss.
Run Code Online (Sandbox Code Playgroud)

有人有任何反馈吗?非常感谢

ruby sass jekyll github-pages

4
推荐指数
1
解决办法
619
查看次数

标签 统计

github-pages ×1

go ×1

jekyll ×1

json ×1

ruby ×1

sass ×1

type-conversion ×1