Skip to content

Commit 8bed638

Browse files
committed
embed api json
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 578df63 commit 8bed638

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
1-
// Licensed to the Apache Software Foundation (ASF) under one
2-
// or more contributor license agreements. See the NOTICE file
3-
// distributed with this work for additional information
4-
// regarding copyright ownership. The ASF licenses this file
5-
// to you under the Apache License, Version 2.0 (the
6-
// "License"); you may not use this file except in compliance
7-
// with the License. You may obtain a copy of the License at
8-
//
9-
// http://www.apache.org/licenses/LICENSE-2.0
10-
//
11-
// Unless required by applicable law or agreed to in writing,
12-
// software distributed under the License is distributed on an
13-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14-
// KIND, either express or implied. See the License for the
15-
// specific language governing permissions and limitations
16-
// under the License.
17-
18-
package config
19-
20-
var preCache = `{
1+
{
212
"api": [
223
{
234
"description": "Creates VPC offering",
@@ -172901,5 +172882,4 @@ var preCache = `{
172901172882
}
172902172883
],
172903172884
"count": 880
172904-
}`
172905-
172885+
}

config/cache.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package config
1919

2020
import (
21+
_ "embed"
2122
"encoding/json"
2223
"fmt"
2324
"io/ioutil"
@@ -33,6 +34,9 @@ const (
3334
FilePathArg = "filepath="
3435
)
3536

37+
//go:embed apis.json
38+
var bundledAPICache []byte
39+
3640
// APIArg are the args passable to an API
3741
type APIArg struct {
3842
Name string
@@ -89,7 +93,7 @@ func LoadCache(c *Config) interface{} {
8993
cache, err := ioutil.ReadFile(cacheFile)
9094
if err != nil {
9195
fmt.Fprintf(os.Stderr, "Loaded in-built API cache. Failed to read API cache, please run 'sync'.\n")
92-
cache = []byte(preCache)
96+
cache = bundledAPICache
9397
}
9498
var data map[string]interface{}
9599
_ = json.Unmarshal(cache, &data)

0 commit comments

Comments
 (0)