Tuesday 30 April 2019

Go and Glide - Problems with Update - Cannot detect VCS

I saw this today: -

glide update

which returns: -

[WARN] Unable to checkout crypto/tls
[ERROR] Error looking for crypto/tls: Cannot detect VCS

I'm using Glide 0.13.2, and Go versions 1.10.6 and 1.11.5.

Using the more detailed glide --debug update, I found a wee bit more detail: -

[DEBUG] ImportDir error on /Users/hayd/.glide/cache/src/https-crypto-tls: cannot find package "." in:

*BUT* this did lead me to look at my Git source folder -  $GOPATH/src - which, amongst other things had this: -

drwxr-xr-x   3 hayd  staff   96 29 Mar 19:31 crypto

which was a directory containing a sinmgle empty subdirectory: -

drwxr-xr-x  2 hayd  staff   64 29 Mar 19:33 tls

So this kinda tied up with the symptom shown up in the --debug trace i.e. cannot find package "." even though it was in a completely different place.

Once I did rm -Rf $GOPATH/src/crypto, the glide update worked a treat.

I'd previously gone down a rabbit hole with glide clear-cache and glide mirror, both of which were poisson rouge.

Hope this helps others in the same situation :-)

Friday 26 April 2019

Input validation of REST requests using GoLang

This is an ongoing W-I-P, as I look at a set of RESTful services that I'm co-developing using Go ( aka GoLang ).

Two things that have been of immense use are: -

Validating Data Structures And Variables In Golang

Regular Expressions 101

the latter of which has been very useful in terms of creating/testing/validating Regular Expressions ( aka RegExp ).

For me, the key thing is to be able to create validation rules within the JSON data structures, and then use the Go-Validator GoLang module/plugin/add-on: -


Specifically, I'm using the latest version 9 ( v9 ): -


Loving my job :-)

Tuesday 23 April 2019

The Modern Mainframe Developer Hands On Drop-In Centre - Thursday, May 2, 2019

Come along at any time, grab a machine and away you go. Refreshments and snacks will be provided. This first meetup is funded by IBM.

The following labs will be provided:

> Lab: IBM Eclipse Mainframe Development for z Systems
> Lab: REST APIs for Mainframe Applications Using z/OS Connect
> Lab: Git for Mainframe Applications
> Lab: Mainframe Code Analyzer Tools

The Modern Mainframe Developer Hands On Drop-In Centre

Sunday 21 April 2019

MainframerZ meetup at Mediaocean, London - Thursday 20 June 2019

Come along to meet other Z professionals, and grow your network. Listen to a series of lightning talks from a range of people currently working in the Z space, and help shape the future of this group.

The lightning talks will be 10 minutes each covering a broad range of topics.

Tentative Agenda

6:15 - 6:45 Arrival and registration
7:00 - 7:10 Introductions
7:10 - 8:10 Lightning talks
8:10 - 8:45 Pizza and networking
8:45 - 9:20 Discussion
9:20 - 9:30 Wrap up

I'm honoured to be one of the speakers for the Lightning talks, so it'd be awesome to see you there, and meet IRL

MainframerZ meetup at Mediaocean

Saturday 20 April 2019

More tales from a GoLang newbie ... expected 'IDENT', found 'break'

I'm adopting, and loving, Microsoft Visual Studio Code ( VSCode ) for all my GoLang needs, but was somewhat confused by this: -

expected 'IDENT', found 'break'

This is my code: -

package break

import (

func BreakGoTest() {
snafu := []interface{}{"First", "Second", "Third"}

Can you see what I did wrong ?

Yep, I've named my package .... break .... which is a reserved word.

Once I changed my package name: -

package breaker

import (

// BreakGoTest - This function does stuff
func BreakGoTest() {
snafu := []interface{}{"First", "Second", "Third"}

all is well.

For the record, this code is merely to allow me to test go fmt .....

Wednesday 10 April 2019

GoLang - weirdness with "panic: assignment to entry in nil map"

I kept seeing this: -

--- FAIL: TestClient (0.00s)
panic: assignment to entry in nil map [recovered]
panic: assignment to entry in nil map

goroutine 5 [running]:
/Users/hayd/Downloads/go/src/testing/testing.go:742 +0x29d
panic(0x128d080, 0x1314b50)
/Users/hayd/Downloads/go/src/runtime/panic.go:502 +0x229
net/textproto.MIMEHeader.Add(0x0, 0x12e2d99, 0xd, 0x12e1ac2, 0x8)
/Users/hayd/Downloads/go/src/net/textproto/header.go:15 +0xec
net/http.Header.Add(0x0, 0x12e2f05, 0xd, 0x12e1ac2, 0x8)
/Users/hayd/Downloads/go/src/net/http/header.go:24 +0x53
github.com/david-hay/GoStuff/cmd/sparkles.glob..func3(0x12e1aba, 0x8, 0x12e1ea3, 0x9, 0xc42006c800, 0x0, 0x0, 0x0, 0x0)
/Users/hayd/go/src/github.com/david-hay/GoStuff/cmd/sparkles/sparkles.go:38 +0xe1
/Users/hayd/go/src/github.com/david-hay/GoStuff/cmd/sparkles/sparkles_test.go:42 +0xc6
testing.tRunner(0xc42011e0f0, 0x12f4678)
/Users/hayd/Downloads/go/src/testing/testing.go:777 +0xd0
created by testing.(*T).Run
/Users/hayd/Downloads/go/src/testing/testing.go:824 +0x2e0
FAIL github.com/david-hay/GoStuff/cmd/sparkles 0.033s

when attempting to test my very basic HTTP code, using Visual Studio Code or just through the GoLang CLI: -

go test ./...

or: -

go test -v ./...

Looking at the stack trace, I saw reference to line 38 of my code: -

req.Header.Add("cache-control", "no-cache")

I commented that out, and the test just ran :-)

Not sure why that line causes that particular exception, given that I'm not actually using a Map, but ....

C'est la vie

Friday 5 April 2019

Seeing the tabs in Vi

I was trying to resolve some tabs vs. spaces issues in my code, and realised that I was using a combination of both.

Thankfully vi has a recipe for that.

In my ~/.vimrc file, I added this: -

set list
set listchars=tab:>-

and now I can see this: -

Nice !

Thursday 4 April 2019

GoLang and the unexpected exit

As with most of my career to-date, I'm on a learning curve ...

This time, it's GoLang, and I'm learning at a fast pace AND loving it !

I was trying to work out why my tests: -

go test ./...

or the more verbose: -

go test -v ./...

were failing with: -

exit status 1

rather than a more useful Panic message.

This helped: -

golang test exit status -1 and shows nothing

by helping me realise that my code had: -


rather than: -


Once I fixed my code, life got a WHOLE lot better.



More on macOS SMB sharing

As a follow-up to an earlier post: - macOS to macOS File Sharing - Don't work, try The IT Crowd I hit this problem again and referred ba...