golang 2行代码在基于arm linux的树莓派、orangepi上运行http web服务

go语言(golang)简化了跨平台交叉编译步骤,支持在windows系统下交叉编译基于arm+linux平台的应用,运行时无需其它依赖库。以下以一个简单的http server为例,先上源码:

 

************************************************************

package main

 

import(

"net/http"

)

 

funcmain(){

http.Handle("/",http.FileServer(http.Dir("html")))

http.ListenAndServe("0.0.0.0:8080",nil)

}
————————————————
版权声明:本文为CSDN博主「luoc83」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/luoc83/article/details/79258566

posted @ 2022-02-12 23:39  China Soft  阅读(189)  评论(0编辑  收藏  举报