<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Draveness on 蛇索尼 Aiden</title><link>https://blog.haitai-social.com/note/%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3/golang/draveness/</link><description>Recent content in Draveness on 蛇索尼 Aiden</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>shesl-meow@qq.com (佘崧林)</managingEditor><webMaster>shesl-meow@qq.com (佘崧林)</webMaster><lastBuildDate>Sun, 18 Jul 2021 13:43:33 +0800</lastBuildDate><atom:link href="https://blog.haitai-social.com/note/%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3/golang/draveness/index.xml" rel="self" type="application/rss+xml"/><item><title>常用关键字</title><link>https://blog.haitai-social.com/note/%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3/golang/draveness/%E5%B8%B8%E7%94%A8%E5%85%B3%E9%94%AE%E5%AD%97/</link><pubDate>Sun, 18 Jul 2021 13:43:33 +0800</pubDate><author>shesl-meow@qq.com (佘崧林)</author><guid>https://blog.haitai-social.com/note/%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8%E6%8E%A5%E5%8F%A3/golang/draveness/%E5%B8%B8%E7%94%A8%E5%85%B3%E9%94%AE%E5%AD%97/</guid><description>defer 实例 下面是一个使用 defer 的实例： 1 2 3 4 5 6 7 8 9 10 func createPost(db *gorm.DB) error { tx := db.Begin() defer tx.Rollback() if err := tx.Create(&amp;amp;Post{Author: &amp;#34;Draveness&amp;#34;}).Error; err != nil { return err } return tx.Commit().Error } 可见它的用法是：defer 之后指定的语句</description></item></channel></rss>