@@ -93,6 +93,7 @@ type item struct {
9393 Examples []example `yaml:"codeexamples,omitempty"`
9494 Children []child `yaml:"children,omitempty"`
9595 AltLink string `yaml:"alt_link,omitempty"`
96+ Status string `yaml:"status,omitempty"`
9697}
9798
9899func (p * page ) addItem (i * item ) {
@@ -186,6 +187,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
186187 Summary : c .Doc ,
187188 Langs : onlyGo ,
188189 Syntax : syntax {Content : pkgsite .PrintType (pi .Fset , c .Decl , link .toURL , topLevelDecls )},
190+ Status : getStatus (c .Doc ),
189191 })
190192 }
191193 for _ , v := range pi .Doc .Vars {
@@ -202,6 +204,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
202204 Summary : v .Doc ,
203205 Langs : onlyGo ,
204206 Syntax : syntax {Content : pkgsite .PrintType (pi .Fset , v .Decl , link .toURL , topLevelDecls )},
207+ Status : getStatus (v .Doc ),
205208 })
206209 }
207210 for _ , t := range pi .Doc .Types {
@@ -217,6 +220,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
217220 Langs : onlyGo ,
218221 Syntax : syntax {Content : pkgsite .PrintType (pi .Fset , t .Decl , link .toURL , topLevelDecls )},
219222 Examples : processExamples (t .Examples , pi .Fset ),
223+ Status : getStatus (t .Doc ),
220224 }
221225 // Note: items are added as page.Children, rather than
222226 // typeItem.Children, as a workaround for the DocFX template.
@@ -235,6 +239,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
235239 Summary : c .Doc ,
236240 Langs : onlyGo ,
237241 Syntax : syntax {Content : pkgsite .PrintType (pi .Fset , c .Decl , link .toURL , topLevelDecls )},
242+ Status : getStatus (c .Doc ),
238243 })
239244 }
240245 for _ , v := range t .Vars {
@@ -251,6 +256,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
251256 Summary : v .Doc ,
252257 Langs : onlyGo ,
253258 Syntax : syntax {Content : pkgsite .PrintType (pi .Fset , v .Decl , link .toURL , topLevelDecls )},
259+ Status : getStatus (v .Doc ),
254260 })
255261 }
256262
@@ -267,6 +273,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
267273 Langs : onlyGo ,
268274 Syntax : syntax {Content : pkgsite .Synopsis (pi .Fset , fn .Decl , link .linkify )},
269275 Examples : processExamples (fn .Examples , pi .Fset ),
276+ Status : getStatus (fn .Doc ),
270277 })
271278 }
272279 for _ , fn := range t .Methods {
@@ -282,6 +289,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
282289 Langs : onlyGo ,
283290 Syntax : syntax {Content : pkgsite .Synopsis (pi .Fset , fn .Decl , link .linkify )},
284291 Examples : processExamples (fn .Examples , pi .Fset ),
292+ Status : getStatus (fn .Doc ),
285293 })
286294 }
287295 }
@@ -298,6 +306,7 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
298306 Langs : onlyGo ,
299307 Syntax : syntax {Content : pkgsite .Synopsis (pi .Fset , fn .Decl , link .linkify )},
300308 Examples : processExamples (fn .Examples , pi .Fset ),
309+ Status : getStatus (fn .Doc ),
301310 })
302311 }
303312 }
@@ -310,6 +319,16 @@ func parse(glob string, workingDir string, optionalExtraFiles []string, filter [
310319 }, nil
311320}
312321
322+ // getStatus returns a possibly empty status string for the given
323+ // docs.
324+ func getStatus (doc string ) string {
325+ deprecated := "\n Deprecated:"
326+ if strings .Contains (doc , deprecated ) {
327+ return "deprecated"
328+ }
329+ return ""
330+ }
331+
313332type linker struct {
314333 // imports is a map from local package name to import path.
315334 // Behavior is undefined when a single import has different names in
0 commit comments