New pkg/depcheck package to check Go version.

Based on kr's example (syntantically valid Go code, to make cmd/go happy, but
will fail to compile and include the failure text)

Change-Id: I11f9eeabf6bf2c77055752014c71183b7eb7b23a
This commit is contained in:
Brad Fitzpatrick 2014-08-19 20:03:36 -07:00
parent ae097a3960
commit b38077ff0f
3 changed files with 52 additions and 0 deletions

View File

@ -26,6 +26,11 @@ import (
"reflect"
"regexp"
"strings"
// This is a pretty low-level package, so add the Go minimum
// version dependency check here at least. This avoids
// adding it in many other places.
_ "camlistore.org/pkg/depcheck"
)
// Pattern is the regular expression which matches a blobref.

19
pkg/depcheck/depcheck.go Normal file
View File

@ -0,0 +1,19 @@
/*
Copyright 2014 The Camlistore Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package depcheck does nothing except for fail to build when
// the system's version of Go is too old.
package depcheck

View File

@ -0,0 +1,28 @@
// +build !go1.3
/*
Copyright 2014 The Camlistore Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package depcheck
import `
****************************************************************************
Camlistore requires Go 1.3 or later.
****************************************************************************
`