Go R1 Day 6
Day 6 of 100
progress
- Learned a little on bubble sort algorithm
- Edited aws-go lambda tests
- Used debugger a bit more to look at error return values on failure
Rebuild Dash Index Due to Corrupted Index
I use Dash for improved doc access.
Terraform updated recently to 0.13.x
and I began having odd issues with AWS provider results coming through.
If you need to rollback, just go to the preferences and pick an older docset, in my case 0.13.0
worked correctly.
Make sure to remove the problematic version (the uninstall refers to just the most recent, not any additional versions you selected under the dropdown)
If the index doesn’t rebuild, you can close the app, manually remove the index, and it will rebuild on open. I’m pretty sure you don’t need to do this if you use the uninstall option in the dialogue.
On macOS 10.15, you can find the index at ~/Library/Application Support/Dash/Data/manIndex.dsidx
and delete this.
Reopen Dash and it will rebuild the index.
Incredible setup experience with gitpod
What a polished setup experience from gitpod. Super impressed as I’ve never seen an interactive terraform setup asking for user input.
This basically generated an entire setup for GitPod, and persisted the Terraform plan for the entire stack it created in a directory for management and adjustments as desired.
I’m seriously impressed.
Check this out at: Install on AWS
|
|
go-R1-D005
Day 5 of 100
progress
- I created my first unit test for go
- It’s a bit interesting coming from a background with PowerShell and Pester as my primary unit test framework. For instance, in Pester you’d declare the anything, but autodiscovery works with
*.tests.ps1
, being the normal convention. - There is no pointer value providing the test package, it’s just other PowerShell calling PowerShell.
- I’m biased I know, but the first test condition being like below seems clunky. I was hoping for something that was more like Pester with
test.Equals(got, want,"Error message")
as the syntax is more inline to what I’d expect. I haven’t dived in further so this is just a thought, hoping this is just the newbie 101 test case example and there are more succinct comparison and test methods available.
|
|
- Update: Good article explaining the opinionated approach with testing and reasoning not to use assertions located at: Golang basics - Writing Units Tests. This is helpful to someone wanting to learn. I don’t want to force my prior paradigms on the language, because basically the whole reason I decided on Go over python or other language was wanting to learn something that helped me think in a fundamentally different way than using dotnet/Powershell. Python is very similar to PowerShell syntax wise for example, while Go is forcing me to look at things from a completely different view.
- I’ll stick with the default package while I’m learning. However, there is a package called Testify that is worth exploring if I find I still want assertions later on.
links
go-R1-D004
Day 4 of 100
progress
- In the last week some more Pluralsight Go (Nigel’s courses are always stellar)
- I’ve done some odd work as had time in between last update, but nothing structured. Might continue with
learn-go-with-tests
but also came across exercism and might tackle that soon as well. - Setup new project in Visual Studio Codespaces
- Used Serverless Framework to generate
aws-go
template project - Imported
aws-go-sdk
resources for AWS SSM Secrets Manager - Grabbed SSM Secrets manager output and used to create a POST request for authorization token
- Used DumpRequest to pretty print output for debugging purpose
- Hung my head in shame at my copy pasta project 😀
- Realized half of the battle is just getting my lambda debugging effort running locally. Not exactly the easiest starter project.
- Need to master different request types. PowerShell makes this easy with Invoke-RestMethod and object construction. I found that the
Post
method wasn’t appropriate as I wanted to control custom headers. This required me to use a different approach, which I ended up doing withhttp.Client{}
. - Not sure in a Go Playground sample to test and echo a post request. Thinking if no service that does this might try creating a Go routine to accept the request locally and echo for the purpose of a demo. Any suggestions welcome.
- Identified i really need better understanding of the godoc libraries as would help a lot. Vscode intellisense even in codespaces isn’t performing great, so I’m not getting that help that would really expedite discovery as a beginner. I might give my EAP Goland install a try and see if it helps.
- Successfully included
zap
logging library - Successfully submitted request for authorization token and got response back into a struct, something that as a newbie I found a major win 🎉 using
json.Unmarshal([]byte(body), ar)
withar
referring to a pointer another win for me as new to pointers) being passed in like below:
|
|
links
go-R1-D003
Day 3 of 100
progress
- Learned about GOROOT, GOPATH and how to configure
- Ran into problems with Visual Studio code reporting:
|
|
- After attempting solution with various profile files, I tried setting the setting:
"go.goroot": "/usr/local/opt/go/libexec/",
insettings.json
and this resolved the issue. - After it recognized this, I ran the
Go: Current GOPATH
from the command palette and it found it. - Finally, after this it reporting back some feedback showing it was recognizing the latest version I was running.
- Initialized a new serverless framework project for
aws-go-mod
template using the following command:serverless create --template aws-go-mod --path ./sqlserver
and the initial project layout was created. - I’m sure this will need to be improved as I go along, but since macOS failed on the go path setup, this resolved my problems for now.
|
|
links
random-microsoft-teams-quirks-01
- Using
cmd+=
results in zooming to 120%,145%,170% - Using
cmd+-
results in zooming out to 85%, 70%, 60%
simple conditional flag in terraform
Sometimes, you just need a very simple flag for enabled or disabled, or perhaps just a resource to deploy if var.stage == "qa"
.
This works well for a single resource as well as collections if you provide the splat syntax.
|
|
go-R1-D002
Day 2 of 100
progress
- Focused on logistics, setup for remaining tests
- Forked Learn Go With Tests
- Setup Visual Studio Codespaces (Docker Workspace) for isolating this work
- Codespaces default container + Added pwsh as default prompt
links
grave accent
TIL: What I’ve been calling the backtick 👉 ```` 👈 for years, is technically the grave accent.
setting default open with on macOS
It should be easy to pick a default program to open a file. On macOS, I was surprised at how poor the design was. Seriously, how is this intuitive? Open With
> Set this as default
. Apparently this only set it for an individual file. This means, every different csv
file required me to do this again.
Instead, I had to Get Info
> Unlock settings
and then choose the default Open With
setting, and further select Use this application to open all documents like this.
I enjoy most of my development experience with macOS.
Don’t try and tell me that it is the pinnacle of usability though, some of this stuff is just quirky and over complicated. In what world, should my default behavior be set on a specific file and not the the file type?
hello world
Day 1 of 100
progress
- Cloned
learning-go-with-tests
to ensure a nice structured start, even though I’ve already donehello-world
- Setup fresh
gotools
updates - Ran golangci-lint through docker to ensure improved linting options ready for further tests - Fixed default debug template in vscode to use workspacefolder instead of file directory. Strange that it defaulted to the wrong path.
links
2020-07-13T14:00:00-05:00
PowerShell has some functionality that can help in pre-processing data by grouping and aggregating.
If you are using ImportExcel
this might be useful to pre-aggregate the results prior to an Excel workbook.
If you are working with PowerShell and needing to do some quick measurement of objects, maybe this will be useful.
2020-07-06T12:00:00-05:00
Windows users, nice little win for making the great git-town tool even more accessible. 🎉
- install scoop:
iwr -useb get.scoop.sh | iex
scoop install git-town
This is one of my favorite tools for git workflow. If you use GitHub flow to keep a simple workflow, it’s a life saver.
For example, on a branch and need to start a new bit of work to keep your commits atomic? switch to master > stash pending work > pull latest with rebase > create new branch > push branch
to remote OR git town hack feat/tacos
. Need to squash commits and ship to master? git town ship
What about prune all those remote branches that have been merged? git town prune-branches
This is one of my favorite git productivity tools (and it’s written in Go 👍 so cross platform and fast)
2020-06-29T18:29:03+00:00
Visual Studio Code has a pretty great way to browse through themes by just selecting installed themes and using arrow keys to preview without apply. However, browsing those themes isn’t quite so good, as you need to install to see the changes.
Ran across [Vscode Themes](https://vscodethemes.com/ https://bit.ly/2NHNsMW “Vscode Themes”) which provides a really nice experience if you feel like changing things up on your editor.
2020-06-24T16:03:49+00:00
After using Windows versions of launchers that tried to emulate Alfred, I finally took the plunge and bought Alfred’s Powerpack. The buyer remorse of paying > $60 on a “shortcut” app hasn’t really set in as I’m seeing such a wealth of great features that I think the gains as a developer and shortcut aficionado will be well worth the cost in my workflow. So far, highly recommend. The best part for me is the easy plugging in of bash/pwsh scripts to execute on demand for quick productivity tasks without having to navigate and open it up in the terminal.
2020-06-17T22:32:32+00:00
Here’s a cool way to visualize runspaces and how they work asynchronously.
|
|
The random delay can help show how some tasks finish out of order. For example, running that might result in this in the console:
|
|
2020-06-10T22:43:37+00:00
Set an environment variable export DOCKER_BUILDKIT=1
to enable a much cleaner Dockerfile output when you don’t need verbose debug level information. Reference: Buildkit
2020-06-05T20:06:36+00:00
brew install micro
resulted in my finding what I think will be my new go to cli editor. Very impressed so far. I’ve got too many things to learn to be fluent in vim, and this cross platform cli tool might be my new best friend for more command line-fu. Micro
2020-06-04T22:15:21+00:00
- add dev container configuration for Go project in Visual Studio code
- Added docker compose file
- Add SQL Server to compose as another service.
docker-compose up -d
- Attach to running container in VSCode
- Magic ⚡
Now I can open Visual Studio Code and run a go project against SQL Server, and tear it all down as I want. Gonna definitely blog on this, as it’s super cool to see this work so well.
While Docker has a steep learning curve, being able to have a full clean dev test environment with SQL Server in a local container and another Ubuntu container to run Go projects in absolutely amazing, not to mention working “inside it” with Remote Workspaces extension from Microsoft.