Golang Embed资源并释放resource


本文摘自网络,作者,侵删。


title: "Golang Embed资源并释放resource"
date: 2021-03-07T15:42:58+08:00
draft: true
tags: ['go']
author: "dadigang"
author_cn: "大地缸"
personal: "http://www.real007.cn"


关于作者

http://www.real007.cn/about

package main

import (
    "embed"
    "fmt"
    "io"
    "os"
)

//go:embed dict.txt
var f embed.FS

func main() {
    fs, _ := os.Create("dictionary.txt")
    helloFile, _ := f.Open("dict.txt")
    io.Copy(fs, helloFile)
    fmt.Println()
}

本文来自:简书

感谢作者:大地缸

查看原文:Golang Embed资源并释放resource

相关阅读 >>

Go语言入门教程06 常量

Golang 协程(Goroutine) 运行过程 与 并发

Go语言学习4-数组类型

Go module 12

Go每日一库 [Go-rate] 速率限制器

linux怎么安装Golang和dep(附错两个误解决方法)

Go 语言入门系列:数组的使用

Golang 异或字符串 xor

Golang context用来干吗

Go语言学习11-数据的使用

更多相关阅读请进入《Go》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    正在狠努力加载,请稍候...