fixing/linting broken markdown
This commit is contained in:
parent
5b30e4ade1
commit
fc8c6dc46d
@ -6,54 +6,54 @@ published: true
|
|||||||
|
|
||||||
Golang (or Go, they are interchangeable and I will use it as such) has blown up over the recent years. For example, some features piqued my interest and when say piqued, I mean it. You probably aren't as hyped about Golang as I am. I suppose it helps when you are such a nerd about back-end and server development as well.
|
Golang (or Go, they are interchangeable and I will use it as such) has blown up over the recent years. For example, some features piqued my interest and when say piqued, I mean it. You probably aren't as hyped about Golang as I am. I suppose it helps when you are such a nerd about back-end and server development as well.
|
||||||
|
|
||||||
Right! Features (a few maybe?):<br>
|
Right! Features (a few maybe?):
|
||||||
* Concurrent<br>
|
- Concurrent
|
||||||
* [Super-duper fast](https://stackshare.io/stackups/c-sharp-vs-go-vs-rust) when compared to Rust and C#.<br>
|
- [Super-duper fast](https://stackshare.io/stackups/c-sharp-vs-go-vs-rust) when compared to Rust and C#.
|
||||||
* Compilation support (super useful for sysadmins using GOOS, I found a [cool video](https://www.youtube.com/watch?v=hsgkdMrEJPs) about this, watched it to it's entirity)<br>
|
- Compilation support (super useful for sysadmins using GOOS, I found a [cool video](https://www.youtube.com/watch?v=hsgkdMrEJPs) about this, watched it to it's entirity)
|
||||||
* Package management (Helpful for devs who use git and use platforms such as GitHub and GitLab)<br>
|
- Package management (Helpful for devs who use git and use platforms such as GitHub and GitLab)
|
||||||
* Interpreter is long gone as Go is compiled (No longer are we in the days of Python and Ruby interpreters)<br>
|
- Interpreter is long gone as Go is compiled (No longer are we in the days of Python and Ruby interpreters)
|
||||||
* Static typing, for fans of that (C++, C#, Java, and Rust devs will know what I am talking about)<br>
|
- Static typing, for fans of that (C++, C#, Java, and Rust devs will know what I am talking about)
|
||||||
* Managed version control repositories (also useful for devs using git)<br>
|
- Managed version control repositories (also useful for devs using git)
|
||||||
* Powerful standard library (flex, Golang, flex!)
|
- Powerful standard library (flex, Golang, flex!)
|
||||||
|
|
||||||
Are you interested yet? I know I am!
|
Are you interested yet? I know I am!
|
||||||
|
|
||||||
What makes a Go program, you might ask? Hold up a sec:
|
What makes a Go program, you might ask?
|
||||||
|
|
||||||
<code>
|
```go
|
||||||
package main<br>
|
package main
|
||||||
|
|
||||||
import(<br>
|
import(
|
||||||
"fmt"<br>
|
"fmt"
|
||||||
"os"<br>
|
"os"
|
||||||
)<br>
|
)
|
||||||
|
|
||||||
var name string = os.Args[1]<br>
|
var name string = os.Args[1]
|
||||||
|
|
||||||
func main(){<br>
|
func main(){
|
||||||
fmt.Println("Hello,", name)<br>
|
fmt.Println("Hello,", name)
|
||||||
}<br>
|
}
|
||||||
</code>
|
```
|
||||||
|
|
||||||
Link to source [here.](https://wyattjmiller/code/main.go)
|
Link to source [here.](https://wyattjmiller.com/code/main.go)
|
||||||
|
|
||||||
I'm back! A lot to take in, isn't there? I'm a beginner too so I will try my best to explain this to my utmost competency.
|
I'm back! A lot to take in, isn't there? I'm a beginner too so I will try my best to explain this to my utmost competency.
|
||||||
|
|
||||||
So the the `package main` deal up top. You will need that to package that up if you want to share this awesome hello world app with your friends.
|
So the the `package main` deal up top. You will need that to package that up if you want to share this awesome hello world app with your friends.
|
||||||
|
|
||||||
The `import` keyword imports packages to help with Go development. So, in this case, I'm importing the formatting tool, `"fmt"`, and the operating system tool, `"os"`, into my awesome hello world app which both packages are in the standard library. With that said, you could import other third party packages, like the ssh package. Since you can't find it [here](https://golang.org/pkg/), I looked on Golang's third party packages for ssh packages and it was pretty obvious that I'd find one. You'd just import:<br>
|
The `import` keyword imports packages to help with Go development. So, in this case, I'm importing the formatting tool, `"fmt"`, and the operating system tool, `"os"`, into my awesome hello world app which both packages are in the standard library. With that said, you could import other third party packages, like the ssh package. Since you can't find it [here](https://golang.org/pkg/), I looked for Golang's third party packages for ssh packages and it was pretty obvious that I'd find one. You'd just import:
|
||||||
|
|
||||||
<code>
|
```go
|
||||||
import(<br>
|
import(
|
||||||
"golang.org/x/crypto/ssh"<br>
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
</code>
|
```
|
||||||
|
|
||||||
I think that's pretty neat as you have flexible package management built right in to Go.
|
I think that's pretty neat as you have flexible package management built right in to Go.
|
||||||
|
|
||||||
Next up, variables! Variables are a bit different as you have to declare them with a `var` and then the name of the variable and then the type of the variable. In my case, I need a variable called `name` with the `string` type because I know it's going to be `string` to begin with. Since Go is statically typed, this kind of breaks the rules (kind of like C# with the `var` keyword) but Go is super smart and can infer the type for you by using the `:=` operator. An example might help:<br>
|
Next up, variables! Variables are a bit different as you have to declare them with a `var` and then the name of the variable and then the type of the variable. In my case, I need a variable called `name` with the `string` type because I know it's going to be `string` to begin with. Since Go is statically typed, this kind of breaks the rules (kind of like C# with the `var` keyword) but Go is super smart and can infer the type for you by using the `:=` operator. An example might help:<br>
|
||||||
|
|
||||||
`name := os.Args[1]`<br>
|
`name := os.Args[1]`
|
||||||
|
|
||||||
Depending on what the argument is when the hello world app runs, it will infer the type for you.
|
Depending on what the argument is when the hello world app runs, it will infer the type for you.
|
||||||
|
|
||||||
|
@ -12,13 +12,19 @@ When I was at work one day, I was tasked with creating a Powershell script. Sinc
|
|||||||
|
|
||||||
You could use the .NET Framework inside your Powershell scripts. Knowing that I could use something that college actually taught me, I was ecstatic. Since I didn't know how write file paths in a reasonable way, I went looking around to see some examples some people had put together. Low and behold, I saw an example that had some .NET in it. Being Powershell is a Microsoft product, it made sense that .NET could live inside a Powershell script.
|
You could use the .NET Framework inside your Powershell scripts. Knowing that I could use something that college actually taught me, I was ecstatic. Since I didn't know how write file paths in a reasonable way, I went looking around to see some examples some people had put together. Low and behold, I saw an example that had some .NET in it. Being Powershell is a Microsoft product, it made sense that .NET could live inside a Powershell script.
|
||||||
|
|
||||||
For example, you could use `System.Math` namespace in Powershell:<br>
|
For example, you could use `System.Math` namespace in Powershell:
|
||||||
`[System.Math]::Sqrt(36)`
|
|
||||||
|
```powershell
|
||||||
|
[System.Math]::Sqrt(36)
|
||||||
|
```
|
||||||
|
|
||||||
to get the result `6`.
|
to get the result `6`.
|
||||||
|
|
||||||
Want to read all the text in a file?<br>
|
Want to read all the text in a file?
|
||||||
`[System.IO.File]::ReadAllText('hello.txt')`
|
|
||||||
|
```powershell
|
||||||
|
[System.IO.File]::ReadAllText('hello.txt')
|
||||||
|
```
|
||||||
|
|
||||||
Isn't that pretty cool??
|
Isn't that pretty cool??
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user