Browse Source

修改项目结构

liuyuqi-dellpc 4 years ago
parent
commit
f3a8911936

+ 7 - 0
.settings/.jsdtscope

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+	<classpathentry kind="src" path=""/>
+	<classpathentry kind="output" path=""/>
+</classpath>

+ 1 - 0
.settings/org.eclipse.wst.jsdt.ui.superType.container

@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.JRE_CONTAINER

+ 1 - 0
.settings/org.eclipse.wst.jsdt.ui.superType.name

@@ -0,0 +1 @@
+Global

+ 0 - 0
src/project/web/Martini/README.md → Martini/README.md


+ 6 - 1
README.md

@@ -14,4 +14,9 @@
 ## project		
 一个工程目录结构如下:
 
-!{}(./images/BaiduHi_2018-8-9_3-35-17.png)
+![](./images/BaiduHi_2018-8-9_3-35-17.png)
+
+执行: go run xx.go
+
+
+

+ 6 - 0
basic/README.md

@@ -0,0 +1,6 @@
+## basic
+
+## run
+
+文件夹下,直接命令行执行: go run xx.go
+

+ 0 - 0
src/calc/calc.go → basic/calc/calc.go


+ 0 - 0
src/class/Student.go → basic/class/Student.go


+ 17 - 0
basic/class/a.go

@@ -0,0 +1,17 @@
+package main
+import "fmt"
+//继承
+type People struct {
+	name string
+	age  int
+}
+
+type Teacher struct {
+	People
+	classroom string
+}
+
+func main() {
+	tea := Teacher{People{"derek", 22}, "911"}
+	fmt.Println(tea.classroom, tea.name, tea.age) //911 derek 22
+}

+ 37 - 0
basic/class/duo.go

@@ -0,0 +1,37 @@
+package main
+
+import "fmt"
+
+//多态
+type Live interface {
+	run()
+}
+
+type People struct {
+	name string
+}
+
+type Animal struct {
+	name string
+}
+
+func (p *People) run() {
+	fmt.Printf("%v在跑步", p.name)
+}
+
+func (a *Animal) run() {
+	fmt.Printf("%v在跑步", a.name)
+}
+
+func allrun(live Live) {
+	live.run()
+}
+
+func main() {
+	//接口不能实例化,只能对接口的结构体实例化
+	peo := &People{"derek"}
+	allrun(peo) //derek在跑步
+	//多态,条件不同结果不同
+	a := &Animal{"小狗"}
+	allrun(a) //小狗在跑步
+}

+ 27 - 0
basic/class/in.go

@@ -0,0 +1,27 @@
+package main
+
+import "fmt"
+
+//接口
+type Live interface {
+	run(i int)
+	eat(thing string)
+}
+
+type People struct {
+	name string
+}
+
+func (p *People) run(i int) {
+	fmt.Println(p.name, "跑了", i, "米")
+}
+
+func (p *People) eat(thing string) {
+	fmt.Println(p.name, "正在吃", thing)
+}
+
+func main() {
+	peo := People{"derek"}
+	peo.run(100)
+	peo.eat("面包")
+}

+ 1 - 0
src/basic/print.go → basic/class/print.go

@@ -4,4 +4,5 @@ import (
 	"fmt"
 )
 
+fmt.Print("哈哈")
 

+ 34 - 0
basic/class/s.go

@@ -0,0 +1,34 @@
+package main
+
+import (
+	"fmt"
+)
+
+//封装
+type People struct {
+	name string
+	age  int
+}
+
+func (p *People) SetName(name string) {
+	p.name = name
+}
+
+func (p *People) SetAge(age int) {
+	p.age = age
+}
+
+func (p *People) GetName() string {
+	return p.name
+}
+
+func (p *People) GetAge() int {
+	return p.age
+}
+
+func main() {
+	peo := new(People)
+	peo.SetName("derek")
+	peo.SetAge(22)
+	fmt.Println(peo.GetName(), peo.GetAge()) //derek 22
+}

+ 0 - 0
src/file/csv.go → basic/file/csv.go


+ 0 - 0
src/main/AnyVary.go → basic/main/AnyVary.go


+ 32 - 0
basic/main/Statement.go

@@ -0,0 +1,32 @@
+package main
+
+import (
+	"fmt"
+)
+
+func if1() {
+	/* 定义局部变量 */
+	var a int = 10
+
+	/* 使用 if 语句判断布尔表达式 */
+	if a < 20 {
+		/* 如果条件为 true 则执行以下语句 */
+		fmt.Printf("a 小于 20\n")
+	}
+	fmt.Printf("a 的值为 : %d\n", a)
+}
+
+func if2() {
+	/* 局部变量定义 */
+	var a int = 100
+
+	/* 判断布尔表达式 */
+	if a < 20 {
+		/* 如果条件为 true 则执行以下语句 */
+		fmt.Printf("a 小于 20\n")
+	} else {
+		/* 如果条件为 false 则执行以下语句 */
+		fmt.Printf("a 不小于 20\n")
+	}
+	fmt.Printf("a 的值为 : %d\n", a)
+}

+ 0 - 0
src/main/test.go → basic/main/test.go


+ 0 - 0
src/main/test2.go → basic/main/test2.go


+ 0 - 0
src/math/math.go → basic/math/math.go


+ 0 - 0
src/net/tcp.go → basic/net/tcp.go


+ 0 - 0
src/simplemath/add.go → basic/simplemath/add.go


+ 0 - 0
src/simplemath/add_test.go → basic/simplemath/add_test.go


+ 0 - 0
src/simplemath/sqrt.go → basic/simplemath/sqrt.go


+ 0 - 0
src/project/web/beego/Makefile → beego/Makefile


+ 0 - 0
src/project/web/beego/README.md → beego/README.md


+ 0 - 0
src/project/web/beego/auto-deploy-local.sh → beego/auto-deploy-local.sh


+ 0 - 0
src/project/web/beego/auto-deploy-remote.sh → beego/auto-deploy-remote.sh


+ 0 - 0
src/project/web/beego/cmd/admin.go → beego/cmd/admin.go


+ 0 - 0
src/project/web/beego/cmd/backup.go → beego/cmd/backup.go


+ 0 - 0
src/project/web/beego/cmd/cmd.go → beego/cmd/cmd.go


+ 0 - 0
src/project/web/beego/cmd/hook.go → beego/cmd/hook.go


+ 0 - 0
src/project/web/beego/cmd/import.go → beego/cmd/import.go


+ 0 - 0
src/project/web/beego/cmd/web.go → beego/cmd/web.go


+ 0 - 0
src/project/web/beego/conf/app.conf → beego/conf/app.conf


+ 0 - 0
src/project/web/beego/controllers/default.go → beego/controllers/default.go


+ 0 - 0
src/project/web/beego/main.go → beego/main.go


+ 0 - 0
src/project/web/beego/routers/router.go → beego/routers/router.go


+ 0 - 0
src/project/web/beego/static/js/reload.min.js → beego/static/js/reload.min.js


+ 0 - 0
src/project/web/beego/tests/default_test.go → beego/tests/default_test.go


+ 0 - 0
src/project/web/beego/views/index.tpl → beego/views/index.tpl


+ 0 - 0
Dockerfile → gogs/Dockerfile


+ 0 - 22
src/main/ErrorFun.go

@@ -1,22 +0,0 @@
-package main
-
-import (
-	"fmt"
-)
-
-// 定义 `int` 类型除法运算的函数
-func Divide(varDividee int, varDivider int) (result int, errorMsg string) {
-    if varDivider == 0 {
-        dData := DivideError{
-            dividee: varDividee,
-            divider: varDivider,
-        }
-        errorMsg = dData.Error()
-        return
-    } else {
-        return varDividee / varDivider, ""
-    }
-
-}
-
-

+ 0 - 54
src/main/Statement.go

@@ -1,54 +0,0 @@
-package main
-
-import (
-	"fmt"
-)
-func if1(){
-	/* 定义局部变量 */
-   var a int = 10
- 
-   /* 使用 if 语句判断布尔表达式 */
-   if a < 20 {
-       /* 如果条件为 true 则执行以下语句 */
-       fmt.Printf("a 小于 20\n" )
-   }
-   fmt.Printf("a 的值为 : %d\n", a)
-}
-func if2(){
-	   /* 局部变量定义 */
-   var a int = 100;
- 
-   /* 判断布尔表达式 */
-   if a < 20 {
-       /* 如果条件为 true 则执行以下语句 */
-       fmt.Printf("a 小于 20\n" );
-   } else {
-       /* 如果条件为 false 则执行以下语句 */
-       fmt.Printf("a 不小于 20\n" );
-   }
-   fmt.Printf("a 的值为 : %d\n", a);
-}
-fun if3(){
-	   /* 定义局部变量 */
-   var a int = 100
-   var b int = 200
- 
-   /* 判断条件 */
-   if a == 100 {
-       /* if 条件语句为 true 执行 */
-       if b == 200 {
-          /* if 条件语句为 true 执行 */
-          fmt.Printf("a 的值为 100 , b 的值为 200\n" );
-       }
-   }
-   fmt.Printf("a 值为 : %d\n", a );
-   fmt.Printf("b 值为 : %d\n", b );
-}
-
-func switch1(){
-	
-}
-
-func switch2(){
-	
-}