Shorcodes Practice

Hudo Shorcodes Practice.

{{< highlight go >}} fmt.Println(“Hello World”) {{< /highlight >}}

1
 fmt.Println("Hello World") 

{{< highlight html >}}

This HTML{{< /highlight >}}
1
2
3
  <html>
    <body> This HTML </body>
  </html>

{{< gist kimi0230 ede767a27a0d62b4d458a17d28708995 >}}

package main
type Obj struct {
name string
age int
work SubObj
}
// 深複製: 把參考物件的變數指向複製過的新物件, 而不是原有他被參考的物件
func (r *Obj) DeepClone() *Obj {
// 深複製
var obj = new(Obj)
obj.work = *(r.work).Clone()
obj.age = r.age
obj.name = r.name
return obj
}
// 淺複製: 被複製物件的所有變數都含有與原來的物件相同的值, 而所有的對其物件的參考都能指向
func (r *Obj) ShallowClone() *Obj {
shallowObj := r
shallowObj.name = r.name
shallowObj.work = *(r.work).Clone()
return shallowObj
}
type SubObj struct {
compnay string
}
func (w *SubObj) Clone() *SubObj {
if w == nil {
return nil
}
shallowObj := w
return shallowObj
}

{{< myshortcode >}}

Hi Hi